zoukankan      html  css  js  c++  java
  • 如果在CEdit中实现Ctrl+V、Ctrl+C、Ctrl+X的功能

    BOOL CCsdn9View::PreTranslateMessage(MSG* pMsg) 
    {
    // if(WM_RBUTTONDOWN == pMsg->message)
    //  return true;
    /* if(WM_KEYDOWN == pMsg->message)
     {
      int nState = GetKeyState(VK_CONTROL);
      if(nState < 0)
      {   
       int  ch = (int) pMsg->wParam ;
       if('x' == ch || 'X' == ch)    
        ::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_CUT,ID_EDIT_CUT,0);
       if('C' == ch || 'c' == ch)    
        ::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_COPY,ID_EDIT_CUT,0);
       if('v' == ch || 'V' == ch)    
        ::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_PASTE,ID_EDIT_CUT,0);
      } 
     }
     
     return CFormView::PreTranslateMessage(pMsg);*/
     UINT  nKeyCode = pMsg->wParam; // virtual key code of the key pressed
     
     if (pMsg->message == WM_KEYDOWN)
     {   
      if ( (nKeyCode == _T('C') || nKeyCode == _T('X') 
       || nKeyCode == _T('V')) && 
       (::GetKeyState(VK_CONTROL) & 0x8000) )
      {
       ::TranslateMessage(pMsg);
       ::DispatchMessage(pMsg);
       return(TRUE);
       
      }
     }
     return CFormView::PreTranslateMessage(pMsg);
     
    }
    注释掉的代码是别一种实现方法
    没有下面的一种简洁


  • 相关阅读:
    Pycharm5注册方式
    五、监听共享目录文件
    三、python webservice
    二、Python安装扩展库
    一、Python安装下载
    test
    拖延
    要乐观对待生活
    乞讨者
    不要总是指责和埋怨
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13318796.html
Copyright © 2011-2022 走看看