Exiting windows.
I am creating my own graphics API for simplicity but have run into a problem. The window is created within a class and the WndProc is a function in the same model which has the class members that create the window. Anyway, when I exit my program, the window is destroyed and I get sent back to my desktop, but the App is still running in the background, just without a window. I can tell it''s running b/c MSVC++ cannot access teh file to link and I see it in the ctr-alt-delete screen and must end task to recompile. Any help would be, uh, helpful. :-)
I have had the same problem before, but it was because DirectX would close me and not Me. So If my program executed something illegal to do with DirectX, like placing a pixel outside the memory range of the screen or something, my game would disappear and all DirectX Recoures(DSound,DInput,DDraw, DPlay) Would all be released but the game was still in the Ctrl+Alt+Delete Window, because I did not call "ExitProcess" in my code. You also have to make sure that your Windows Message Loop stops when you exit.
Hope this helps a bit!
See ya,
Ben
Hope this helps a bit!
See ya,
Ben
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
This has happened with me when I mistakenly had my message loop with the form:
GetMessage(hwnd . . .)
This will only receive messages associated with this window. I wanted:
GetMessage(NULL . . .)
which receives all messages, including those not associated with any window (like WM_QUIT.)
GetMessage(hwnd . . .)
This will only receive messages associated with this window. I wanted:
GetMessage(NULL . . .)
which receives all messages, including those not associated with any window (like WM_QUIT.)
It only happens when I exit the App VIA alt-f4. I change the PeekMessage part to NULL, but it didn''t work. In my WndPrc case WM_DESTROY called PostQuitMessage(0). It still doesn''t work. If there anybody there willing to sort through my code and try it themselves? It is only 4 files, 2 headers and 2 source files. This is driving me crazy...
I had a similar problem, which was not declaring my WndProc with the CALLBACK macro.
CALLBACK makes sure the correct calling convention is used, and DX depends on the exact calling convention. Also, make sure you have your function declared static in your class.
I'll look through the code!
- null_pointer
Sabre Multimedia
Edited by - null_pointer on 5/5/00 7:30:57 AM
// in the .h file:
class Window
{
public:
static LRESULT CALLBACK Procedure(HWND, UINT, WPARAM, LPARAM);
};
// in the .cpp file:
LRESULT CALLBACK Window:: Procedure(HWND, UINT, WPARAM, LPARAM);
CALLBACK makes sure the correct calling convention is used, and DX depends on the exact calling convention. Also, make sure you have your function declared static in your class.
I'll look through the code!
- null_pointer
Sabre Multimedia
Edited by - null_pointer on 5/5/00 7:30:57 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement