Skip to main content
gamedev.net
🔒 Locked

problem with PostQuitMessage

Started by ashogay 2 replies 450+ views
Original Post
ashogay
ashogay
I'm writing a game (using DirectX) I don't know what's going wrong but during the game loop, if a quit message occurs (PostQuitMessage(0) or closing a window), the window closes but there's an error window saying that there's a problem with the ole32.dll thing. Sometimes it says there's a problem with the ntdll.dll thing. And sometimes it just closes cleanly. Does anybody know what's wrong? Thanks!!
lack o comments
lack o comments
Well, ole32.dll contains COM components, and of course, DirectX uses COM. Are you using the COM functions correctly? Functions like: CoInitialize(), CoUnitialize(), CoCreateInstance(), etc... How are you handling the WM_QUIT/WM_CLOSE/WM_DESTROY messages?
ashogay
ashogay
It happens when I call CoUninitialize() when quiting the game.
I used CoInitialize and CoCreateInstance when I created directmusic interfaces.
I tried to comment the CoUninitialize out and there was no problem but is this right? Shouldn't I be closing down COM?
lack o comments
lack o comments
I have read that you can call CoInitialize() many times as long as you call CoUninitialize() an equal number of times. In my experience, this causes crashes. Try making sure you are only calling CoInitiailze() once at the beginning, and CoUninitialize() once at the end.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.