Click here to Skip to main content
15,917,632 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a project in MFC, in which i choose Visual Studio Style Application.

In it i deleted the existing dockable windows.

I created my own dockable window under name "CMyDockWindow"

When i run the project its working fine, showing a dock window..

i added an OnClose() event in that "CMyDockWindow" class.

but when i close my dock window in my app, the event doesnt fired.

i have added that OnClose() routine using wizard, and its not showing any errors.

Is it ON_WM_CLOSE() hit when i close my Dock Window?
Posted

1 solution

WM_CLOSE is not always called on a window. The windows documentation states:

The WM_CLOSE message is sent as a signal that a window or an application should terminate.

Normally you catch WM_CLOSE to implement a user prompt, when the user has left some unsaved changes. Then, to really close the window you would call DestroyWindow, which in turn generates a WM_DESTROY and a WM_NCDESTROY message.

Better catch WM_NCDESTROY, which is the last message that a window ever sees. That's a good point to do cleanup.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900