Pages: 1
Author Topic: C++ DestroyWindow() alternative  (31,759 Views)
Offline (Unknown gender) time-killer-games
Guest


Email
Posted on: October 04, 2014, 06:45:29 PM
DestroyWindow() closes my browser control but I recently discovered it also causes the game to crash after about 5-10 seconds.

Is there any other means possible I can close my browser window without closing or crashing the parent? GMStudio doesn't seem to like DestroyWindow(), and CloseWindow() doesn't actually close anything it just minimizes.  TerminateProcess() closes everything including the parent process.

Please help.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #1 Posted on: October 04, 2014, 07:07:15 PM
Hope this helps TKG.
http://stackoverflow.com/questions/2908632/why-does-destroywindow-close-my-application
Offline (Unknown gender) time-killer-games
Guest


Email
Reply #2 Posted on: October 04, 2014, 07:19:13 PM
I can't do that because it requires DestroyWindow() which crashes GameMaker.

While using the hwnd param as the game handle can close the game:
SendMessage(hWnd, WM_CLOSE, 0, 0);
I try the same thing on my browser handle and it just acts like it isn't supposed to do anything which is weird.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #3 Posted on: October 04, 2014, 07:30:42 PM
This post suggest you can set the parent of it to NULL and then destroy it.
https://forums.ni.com/t5/LabVIEW/Remove-Child-Window-from-Parent-using-WIN-API/td-p/1470888
Offline (Unknown gender) time-killer-games
Guest


Email
Reply #4 Posted on: October 04, 2014, 08:07:20 PM
The funny thing is I've already tried setting the parent to the desktop handle a day or two ago and it still crashes. But I'll try it with the parent param as NULL and get back to you! Thank you! I'm a geek in training! ;D
Offline (Unknown gender) lonewolff
Guest


Email
Reply #5 Posted on: October 04, 2014, 11:04:11 PM
What does your las result callback for the client window look like?

You aren't doing PostQuitMessage() or something silly like that?
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #6 Posted on: October 05, 2014, 12:16:14 AM
Yes, let's see the code TKG.
Pages: 1