OutLook样式类使用过程,弹出模式对话框时候,鼠标不能点击对话框按钮,的问题。

本文介绍如何在OnOutbarNotify函数中正确打开模式对话框。通过调用ReleaseCapture()来解决由鼠标捕获导致的弹窗显示不全的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 使用类CGfxOutBarCtrl类,在响应消息点击消息的时候,

long CMainFrame::OnOutbarNotify(WPARAM wParam, LPARAM lParam)
{
    switch (wParam)
 {
  case NM_OB_ITEMCLICK:
  // cast the lParam to an integer to get the clicked item
   {
    int index = (int) lParam;
    CString cs;
       cs = m_OutBar.wndBar.GetItemText(index);
         ReleaseCapture();//释放鼠标扑捉----------------!!!!!!!!!!!!
          //执行弹出模式对话框后,CMyDialog dlg; dlg.DoModal();出现问题。

   }
  return 0;
  case NM_OB_ONLABELENDEDIT:
  // cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited item
  // return 1 to do the change and 0 to cancel it
   {
    OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
    TRACE2("Editing item %d, new text:%s/n", pOI->index, pOI->cText);
   }
  return 1;
  case NM_OB_ONGROUPENDEDIT:
  // cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited folder
  // return 1 to do the change and 0 to cancel it
   {
    OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
    TRACE2("Editing folder %d, new text:%s/n", pOI->index, pOI->cText);
   }
  return 1;
  case NM_OB_DRAGITEM:
  // cast the lParam to an OUTBAR_INFO * struct; it will contain info about the dragged items
  // return 1 to do the change and 0 to cancel it
   {
    OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
    TRACE2("Drag item %d at position %d/n", pOI->iDragFrom, pOI->iDragTo);
   }
  return 1;
 }
 return 0;
 
}

//////////////////////////////////////////以下是对这个问题的解释、

Trick:   How   to   open   a   modal   dialog   from   the   OnOutbarNotify   funtion  
   
  --------------------------------------------------------------------------------  
  Since   may   have   written   to   me   reporting   trouble   when   trying   to   execute   a   modal   dialog   box   from   within   the   OnOutbarNotify   function,   here's   the   trick;    
  -   add   ReleaseCapture();   before   opening   your   dialog    
   
  The   trouble   is   related   to   how   the   bar   control   capture   the   mouse   to   get   the   hoover   look;   if   the   control   has   capture   (as   is   always   the   case   in   this   function),   no   modal   will   be   correctly   executed   until   you   release   the   mouse   capture,   with   the   function   above.  

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值