现在的位置: 首页 > 综合 > 正文

VC/MFC 使edit控件不能进行粘贴操作

2014年01月07日 ⁄ 综合 ⁄ 共 431字 ⁄ 字号 评论关闭
这里使用消息拦截的方法
BOOL PersonDlg::PreTranslateMessage(MSG* pMsg)
{
	if (GetDlgItem(IDC_EDIT_USER_ID)->m_hWnd == pMsg->hwnd ||
		GetDlgItem(IDC_EDIT_USER_NAME)->m_hWnd == pMsg->hwnd ||
		GetDlgItem(IDC_EDIT_PHONE)->m_hWnd == pMsg->hwnd ||
		GetDlgItem(IDC_EDIT_IDCARD)->m_hWnd == pMsg->hwnd )	
    {	
        if (pMsg->message == WM_RBUTTONUP || pMsg->message == WM_KEYDOWN && pMsg->wParam == 'V' && (GetAsyncKeyState(VK_CONTROL) & 0x8000))			
            return TRUE;		
    }
	return CRTDialog::PreTranslateMessage( pMsg );
}

 

抱歉!评论已关闭.