标签:cWeb c style class blog code
要截获window.close(),就得截获CDHtmlDialog的WindowClosing。以下是示例代码:
// header DECLARE_EVENTSINK_MAP() void WindowClosing(VARIANT_BOOL IsChildWindow, VARIANT_BOOL *Cancel);
// cpp BEGIN_EVENTSINK_MAP(CWebTestDlg, CDHtmlDialog) ON_EVENT(CWebTestDlg, AFX_IDC_BROWSER, DISPID_WINDOWCLOSING, WindowClosing, VTS_BOOL VTS_PBOOL) END_EVENTSINK_MAP() void CWebTestDlg::WindowClosing(VARIANT_BOOL IsChildWindow, VARIANT_BOOL *Cancel) { *Cancel = TRUE; ShowWindow(SW_HIDE); }
注意:CDHtmlDialog的ON_EVENT用的是AFX_IDC_BROWSER,CHtmlView用的是AFX_IDW_PANE_FIRST;用错了,效果就出不来了。
在CDHtmlDialog中处理WindowClosing,布布扣,bubuko.com
标签:cWeb c style class blog code
原文地址:http://www.cnblogs.com/icedream/p/3759579.html