BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg-> message==WM_SYSKEYDOWN)
{
if(pMsg-> lParam&0x21000000)
{
if(pMsg-> wParam== 'C')
MessageBox("ALT+C");
}
}
return CDialog::PreTranslateMessage(pMsg);
}这样为啥不行呢?
{
if(pMsg-> message==WM_SYSKEYDOWN)
{
if(pMsg-> lParam&0x21000000)
{
if(pMsg-> wParam== 'C')
MessageBox("ALT+C");
}
}
return CDialog::PreTranslateMessage(pMsg);
}这样为啥不行呢?
Alt默认会启动菜单
{
// TODO: Add your specialized code here and/or call the base class
if((WM_SYSKEYDOWN == pMsg->message) && (_T('C') == pMsg->wParam))
{
if(GetKeyState(VK_MENU)<0) // VS这里换成VK_ALT
{
AfxMessageBox(_T("ALT + C"));
}
}
return CDialog::PreTranslateMessage(pMsg);
}