Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class(Child window )destructor not getting called

Tags:

c++

winapi

I have created a window which has a toolbar with some icons, and I launch one more window clicking on the available icon from the main window.

First window is created using CreateWindowEx method. the one I click using an icon is created using dialog resource. So without closing dialog, I directly close the main window. I see that dialog window is not getting closed. When I debug, control does not come to destructor of second window.

When I close them individually (i.e dialog first) and then main window next,then everything is fine.

Please help,that what might be missing when I close the main window.

I mean class desctructor is not getting called.

like image 940
Vishu Avatar asked Feb 07 '26 15:02

Vishu


1 Answers

Handle your main window's message WM_CLOSE and check, whether the dialog window is open or not. If dialog window is open, just close it using the handle you got returned while loading it from resources.

like image 111
Aoi Karasu Avatar answered Feb 09 '26 06:02

Aoi Karasu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!