Failed to call class destructor (child window)

I created a window that has a toolbar with some icons, and I launch another window by clicking on the available icon from the main window.

The first window is created using the CreateWindowEx method. the one I click using the icon is created using the dialog resource. Therefore, without closing the dialog, I directly close the main window. I see that the dialog does not close. When I debug, control does not come to the second window's destructor.

When I close them individually (first in the dialog box) and then in the main window, then everything is in order.

Please help what may be missing when I close the main window.

I mean, the class handle is not called.

+3
source share
1 answer

Refer to the message in your main window WM_CLOSEand check if the dialog box is open or not. If the dialog box is open, just close it using the handle you got while loading it from the resources.

+1
source

Source: https://habr.com/ru/post/1760259/


All Articles