对DestoryWindow的解释.

 给应用程序发个消息让其退出,在主窗口中响应消息退出,若此时打开了其它窗口,如创建了一个模态对话框,此时主窗口响应消息并不能退出,原因是模态对话框没有关闭,这时关闭模态对话框会出现应用程序立即退出的状况。若主窗口打开的所有子窗口中没有模态对话框,主窗口就会各个子窗口发送销毁消息。先Destory子窗口,在退出自身。

MSDN:对DestoryWindow的解释.(WINCE)

This method destroys the Windows CE window attached to this CWnd object. The DestroyWindow method sends appropriate messages to the window to deactivate it and remove the input focus. It also destroys the Windows menu, flushes the application queue,
destroys outstanding timers, removes Clipboard ownership,
and breaks the Clipboard-viewer chain if CWnd is at the top of the viewer chain.
It sends WM_DESTROY and WM_NCDESTROY messages to the window. It does not destroy the CWnd object.

virtual BOOL DestroyWindow ( );
Return Value

Nonzero if the window is destroyed; otherwise, it is zero.

Remarks

DestroyWindow is a place holder for performing cleanup. Because DestroyWindow is a virtual function,
it is shown in any CWnd-derived class in ClassWizard. But even though you override this function
in your CWnd-derived class, DestroyWindow is not necessarily called.
If DestroyWindow is not called in the MFC code,
then you have to explicitly call it in your own code if you want it to be called.

Assume, for example, you have overridden DestroyWindow in a CView-derived class.
Since MFC source code does not call DestroyWindow in any of its CFrameWnd-derived classes,

your overridden DestroyWindow will not be called unless you call it explicitly.

If the window is the parent of any windows,

these child windows are automatically destroyed when the parent window is destroyed.
The DestroyWindow method destroys child windows first and then the window itself.

The DestroyWindow method also destroys modeless dialog boxes created by CDialog::Create.

If the CWnd being destroyed is a child window and does not have the WS_EX_NOPARENTNOTIFY style set,
then the WM_PARENTNOTIFY message is sent to the parent.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值