Archived

This topic is now archived and is closed to further replies.

process still running, and other strangeness

This topic is 5107 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am making a MDI app (straight win32, no MFC) with openGL (it is for editing multiple tilemaps at once)... and strange things are happening! first and foremost, when i close the program (with the "X" button, or the menu which posts a WM_CLOSE to the main MDI window), there is still a process running for it. i also tried posting a WM_QUIT, which gives the same results. am i missing something here? also, when i maximize one of the child windows, and then close it while maximized, both the system icon (in the upper left of the child window) and the "min/max/X" buttons remain behind. normally the next child window will become maximized, but instead the rest are staying put and the buttons don''t go away. so, if i maximize and then close several windows, the buttons and icons line up along the top of my main window. anyone know of such things, and if so how to fix them? thanks!

Share this post


Link to post
Share on other sites
Make sure your message loop is EXACTLY how do it over in the WinProg tutorials. Subtle differences in that can really screw you up. Also, you say PostQuitMessage(0); on receipt of WM_CLOSE in your main window to properly shut the application down. At that point you should be cleaning things up (or with destructors), killing threads, destroying windows, etc etc etc.

Share this post


Link to post
Share on other sites
yah, i''ll have to check it over with a fine-tooth comb when i wake up later... it is so hard to think when the sun is up!

if anyone thinks of anything offhand feel free to post it!

Share this post


Link to post
Share on other sites
I wouldn''t really handle WM_QUIT. That''s not too good of an idea, unless you also call DefWindowProc.

Usually, the pro-quo is to handle WM_CLOSE, and call PostQuitMessage(0) from there.

Share this post


Link to post
Share on other sites
quote:
Original post by krez
i am making a MDI app (straight win32, no MFC) with openGL (it is for editing multiple tilemaps at once)... and strange things are happening!

first and foremost, when i close the program (with the "X" button, or the menu which posts a WM_CLOSE to the main MDI window), there is still a process running for it. i also tried posting a WM_QUIT, which gives the same results. am i missing something here?

also, when i maximize one of the child windows, and then close it while maximized, both the system icon (in the upper left of the child window) and the "min/max/X" buttons remain behind. normally the next child window will become maximized, but instead the rest are staying put and the buttons don''t go away. so, if i maximize and then close several windows, the buttons and icons line up along the top of my main window.

anyone know of such things, and if so how to fix them?

thanks!


I could be wrong, but from what I took from MFC, MDI applications are handled different from SDI applications, in that instead of having just a main window, as with an SDI application, an MDI application has a parent window and child windows for the various documents that are open. Is it possible you''re handling the message for the wrong window? Not sure if that helps, but thought it worth mentioning.

-hellz

Share this post


Link to post
Share on other sites
i am not handling the WM_QUIT... i meant i was calling "PostQuitMessage()"...

in the WM_CLOSE handler, i loop through the open child windows and close them (by SendMessage()ing a WM_CLOSE to them), then call DestroyWindow(hwnd).

in WM_DESTROY, it simply PostQuitMessage()es.

this is nearly identical to a (fully-working) openGL-with-MDI-windows tutorial i found. except that mine doesn''t work

hmmmm...

Share this post


Link to post
Share on other sites
ok... harrumph!

i was using:
while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) != WM_QUIT) {} 

for my main loop... and the example i was basing my ideas off used:
while(GetMessage(&Msg, NULL, 0, 0)) {} 


so, now i don''t have the process still running after i close the window (strange, i guess that is yet another difference between normal apps and MDI apps)...

does anyone have a clue about my other problem? the one with the child windows leaving their "X", "_", "[]" buttons behind when i close them while maximized?

Share this post


Link to post
Share on other sites
well, i don''t think anyone cares, but i figured it out and will share.

you see, i have a class with info for each child window, and a pointer to it attached to each window (using the SetWindowLong() function). when the child windows received a WM_CLOSE, it would delete the pointer and remove it from the list; inside the destructor, i called DestroyWindow(). i am assuming that calling DestroyWindow() before DefMDIChildProc() was causing the problem, since when i removed that line it worked properly.

Share this post


Link to post
Share on other sites