方法一:
#define WM_NCLBUTTONDBLCLK 0x00A3
LRESULT CMainFrame::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam){
// TODO: Add your specialized code here and/or call the base class
switch(message)
{
case WM_NCLBUTTONDBLCLK:
if(HTCAPTION==wParam)
{
return 0;
}
}
return CFrameWnd::DefWindowProc(message, wParam, lParam);
}
方法二:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_NCLBUTTONDBLCLK)
{
return TRUE;
}
return CFrameWnd::PreTranslateMessage(pMsg);
}
BOOL CTestlDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_NCLBUTTONDBLCLK)
{
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
本文介绍了两种处理窗口标题栏双击事件的方法:一种是在`DefWindowProc`中通过`switch`语句捕获`WM_NCLBUTTONDBLCLK`消息并作出响应;另一种是在`PreTranslateMessage`函数中检查消息是否为`WM_NCLBUTTONDBLCLK`并返回`TRUE`以阻止默认行为。
1492

被折叠的 条评论
为什么被折叠?



