VC++禁止标题栏鼠标双击事件

转载:http://blog.sina.com.cn/s/blog_4ad042e50102dwv0.html

重载DefWindowProc,在里面截获WM_NCLBUTTONDBLCLK消息进行处理:  
  LRESULT   CDlg::DefWindowProc(UINT   message,   WPARAM   wParam,   LPARAM   lParam)    
  {  
  //   TODO:   Add   your   specialized   code   here   and/or   call   the   base   class  
                    if(   message   ==   WM_NCLBUTTONDBLCLK   &&   (INT)wParam   ==   HTCAPTION  )  
                    {  
                        return   0;  
                    }  
  return   CDialog::DefWindowProc(message,   wParam,   lParam);  
  }


 

>>>>>>>>>

重载DefWindowProc()函数,过滤WM_NCLBUTTONDBLCLK在HTCAPTION区的响应即可:
LRESULT CMain::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 CWnd::DefWindowProc(message, wParam, lParam);
}
原文地址:https://www.cnblogs.com/chechen/p/5133279.html