我用VS2003中的VC++,我已在我的对话框应用中禁止了右键菜单,但无法禁止用Ctrl-V将字符串粘贴到EDIT控件中。请各位大侠帮帮小弟。

解决方案 »

  1.   

    子类化窗口,屏蔽 WM_PASTE 消息。
      

  2.   

    可是我在类的属性框中的消息列表中找不到 WM_PASTE 这一消息,如何屏蔽这一消息呢?
      

  3.   

    Dlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if((WM_KEYDOWN == pMsg->message)
    && (pMsg->wParam == 'V') && (GetKeyState(VK_CONTROL)))
    return TRUE;
    return CDialog::PreTranslateMessage(pMsg);
    }
      

  4.   

    最后应用时,(GetKeyState(VK_CONTROL))改为:
    (GetKeyState(VK_LCONTROL)&0xff00) != 0 || (GetKeyState(VK_RCONTROL) & 0xff00) != 0 )
    才正常。