D D影子D Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-27 #1 怎么样拦截sendmessage的WM_close消息 然后进行处理?
Z zw84611 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-27 #2 重载PreTranslateMessage(MSG* pMsg) : BOOL CTestDlg:reTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_CLOSE)AfxMessageBox("WM_CLOSE"); return CDialog:reTranslateMessage(pMsg); }
重载PreTranslateMessage(MSG* pMsg) : BOOL CTestDlg:reTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_CLOSE)AfxMessageBox("WM_CLOSE"); return CDialog:reTranslateMessage(pMsg); }
D delphi_vcl Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-12 #5 重载WindowProc 函数 代码如下: // TODO: Add your specialized code here and/or call the base class if(message==WM_CLOSE) AfxMessageBox("hello"); return CDialog::WindowProc(message, wParam, lParam);
重载WindowProc 函数 代码如下: // TODO: Add your specialized code here and/or call the base class if(message==WM_CLOSE) AfxMessageBox("hello"); return CDialog::WindowProc(message, wParam, lParam);
W win32api Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-27 #6 具体的写法是: 首先在mainfrm.h文件中的消息处理那里定义你自己的处理程序 例如:afx_msg void OnClose(); 然后在mainfram.cpp中的宏 begin _MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_WM_CLOSE()//新增的消息 //}}AFX_MSG_MAP END_MESSAGE_MAP() 最后在写出消息处理程序就OK了 void CMainFrame::OnClose() { //…… }
具体的写法是: 首先在mainfrm.h文件中的消息处理那里定义你自己的处理程序 例如:afx_msg void OnClose(); 然后在mainfram.cpp中的宏 begin _MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_WM_CLOSE()//新增的消息 //}}AFX_MSG_MAP END_MESSAGE_MAP() 最后在写出消息处理程序就OK了 void CMainFrame::OnClose() { //…… }