I know how to create child windows. But what if I want to create one window (for example to customise settings) and after destroying it - a second one (based on a HGE engine). If I could break message loop by WM_DESTROY I could create second window after this message loop. But as I know GetMessage returns 0 only in WM_QUIT message and I cannot send this message because it means: "Close the application" not "Close the window". So my question is: How can i break message loop when first window gets WM_DESTROY? Is that actually possible?
WinAPI Creating another window after destroying previous one
97 Views Asked by user2854935 At
2
There are 2 best solutions below
0

It's quite simple really, and you should not be attempting to break out of you message loop.
- When you handle the WM_CLOSE message for the first window, call CreateWindow etc. to create and show the second window.
- When you handle the WM_DESTROY message for the second window, call PostQuitMessage to bring things to a close.
Just use PostMessage.