我想在同时按下“control”和“d”键时,弹出一个对话框,这样写为什么不行?BOOL CKeyView::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_CHAR)
if( pMsg->wParam == 'd')
{
if(::GetKeyState(VK_CONTROL)<0)
MessageBox("Hi, Guys!");
}
return CView::PreTranslateMessage(pMsg);
}该怎么做呢?大家帮下忙啊!
{
if( pMsg->message == WM_CHAR)
if( pMsg->wParam == 'd')
{
if(::GetKeyState(VK_CONTROL)<0)
MessageBox("Hi, Guys!");
}
return CView::PreTranslateMessage(pMsg);
}该怎么做呢?大家帮下忙啊!
)
{
if(GetDlgItem(IDC_EDIT1)->GetSafeHwnd() == pMsg->hwnd)
if(WM_KEYDOWN == pMsg->message)
if(VK_RETURN == pMsg->wParam)
{
int nState = GetKeyState(VK_CONTROL);
if(0 != nState)
AfxMessageBox("ctrl+return");
}
return CDialog::PreTranslateMessage(pMsg);
}
这时ctrl + 回车
符合你的要求吗?
如果不明白,你可以
(1),给我发短消息(请附帖子的地址).
(2),根据http://www.vcshare.net上的联系方式与我联系,推荐QQ.
(3),如果问题简单,请在http://www.vcshare.net/bbs上发帖.
如果问题比较复杂,请把代码压成*.rar当附件发在我的论坛上发帖.
同时在www.csdn.net上发帖,并给出在我的论坛的链接.
---------------
压代码前,请先删除debug,release文件夹,及*.opt,*.ncb,*.plg,*.aps.
{
if(pMsg->wParam>='d')
{
if(GetKeyState(VK_CONTROL)&0x8000)
{
MessageBox("Hi, Guys!");
}
}
}
return CView::PreTranslateMessage(pMsg);应该这样写,你试试