To: forover(天下无吥散dě宴席) 能否给点样例代码?To: tyro1(栖息的飞鸟) PreTranslateMessage 抓消息,请问具体怎么弄的?
用classwizard,重写editbox所在对话框的PreTranslateMessage。 BOOL CBmptranceDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class
return CDialog::PreTranslateMessage(pMsg); }
BOOL CExDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_CONTROL && pMsg->hwnd == GetDlgItem(IDC_EDIT1)->m_hWnd) { return TRUE; } return CDialog::PreTranslateMessage(pMsg); }
还不行! “CTRL + C”、“CTRL +V”还是能用.我的代码,请问哪不对? BOOL CAboutDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class
pMsg->hwnd == m_editbox.m_hwnd && pMsg->message ==wm_keydown && pMsg->wParam == VK_CONTROL 这三个条件满足 return TRUE
能否给点样例代码?To: tyro1(栖息的飞鸟)
PreTranslateMessage 抓消息,请问具体怎么弄的?
BOOL CBmptranceDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::PreTranslateMessage(pMsg);
}
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_CONTROL && pMsg->hwnd == GetDlgItem(IDC_EDIT1)->m_hWnd) {
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
BOOL CAboutDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->hwnd == GetDlgItem(IDC_EDIT2)->m_hWnd && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_CONTROL )
{
return true;
}
return CDialog::PreTranslateMessage(pMsg);
}
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam=='V' && (GetKeyState(VK_CONTROL) & 0x80))
{
{
return TRUE;
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
其他同理..