🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Rendering on child windows

Started by
4 comments, last by そら 2 years, 1 month ago

So… I want my engine to be able to switch between game (one swapchain) and editor (4 swapchains)…

For that to happen I am creating a main window from which I create a child window to render my in-game content (which later could be 4 child windows when switching to the editor)… so far everything looks ok… BUT… handling windows messages is a mess…

If I try to close the window pressing the X button on top neither the main parent window nor the child window seem to recieve the WM_CLOSE / WM_DESTROY message… although they both recieve WM_SETFOCUS / WM_KILLFOCUS messages, and the child window recieves all the mouse/paint messages.

Has anyone experience working with parent/child windows message handling who could tell how to deal with the CLOSE/DESTROY messages?…

"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
Advertisement

I think you might want to listen for the WM_SYSCOMMAND message with SC_CLOSE for wParam. This message is sent when the user presses the close button.

@Aressera well, just tried that one, and looks like neither of the windows (parent & child) recieve that message when pressing the close button.

but if I run without adding a child HWND the main window does recieve it, tho.

"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

It sounds like you have a bug somewhere else in how the events are passed around. Are you creating all windows on the main thread? Doing that on threads other than the main one can cause weird behavior like this in my experience.

@Aressera uhmmm… indeed, made a clean VisualStudio project with nothing but the two windows and they seem to work properly…. will have to investigate.

Thanks!

"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

This topic is closed to new replies.

Advertisement