Multiple Windows in Win32
Okay, what I need to do is have one window create another window, but I''ve written so much code already that I don''t think I could transfer it all into a MDI program... I''m working in Win32 here, no MFC. What i''m doing is calling a CreateSecondWindow function of mine that goes through the motions of creating a window class, registering it, etc. Problem is, Whenever I start the second window''s message loop, the whole first window freezes. I can manipulate the second window and everything, but the entire first window goes dead, even after I close the second window. I have to ctrl-alt-del to close the program. Any idea what i''m doing wrong? Thanks.
Hi there, I''m AnCcE, and you''d be too if you weren''t somebody else.
Hi there, I''m AnCcE, and you''d be too if you weren''t somebody else.
well if I remeber right....
instead of using GetMessage like this:
GetMessge(&msg,hwnd,0,0);
use
GetMessage(&msg,NULL,0,0);
this will grab and procces any message for the current thread.
if your using PeekMessage then its basicly the same thing...
Great Milenko
instead of using GetMessage like this:
GetMessge(&msg,hwnd,0,0);
use
GetMessage(&msg,NULL,0,0);
this will grab and procces any message for the current thread.
if your using PeekMessage then its basicly the same thing...
Great Milenko
Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."
http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
The reason why the first window stops responding is because the cpu has now focused on processing messages of the secondary window until it closes (thus allowing you to manipulate it). The reason why you can''t access the main window after the secondary is closed is probably just a bug in the window closing code.
Try creating the second window with its own thread, this way the user can play with both windows and they can operate independantly (sounds complicated but is much more organized that way). If this is a mdi-like application, remember to keep either the handle or a pointer to the thread in the main program so you can terminate the spawned windows if the user closes the main window.
Another thing, you shouldn''t need to create a new class (and/or register it) for every window, probably only have 2 total (1 for the main app/parent, and 1 describing all those spawned from the first).
Try creating the second window with its own thread, this way the user can play with both windows and they can operate independantly (sounds complicated but is much more organized that way). If this is a mdi-like application, remember to keep either the handle or a pointer to the thread in the main program so you can terminate the spawned windows if the user closes the main window.
Another thing, you shouldn''t need to create a new class (and/or register it) for every window, probably only have 2 total (1 for the main app/parent, and 1 describing all those spawned from the first).
___________________________Freeware development:ruinedsoft.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement