VC處理按鍵消息

BOOL CMFCApplication1Dlg::PreTranslateMessage(MSG* pMsg)
{
	// TODO: 在此添加專用代碼和/或調用基類
	if (pMsg->message == WM_KEYDOWN)
	{
		switch (pMsg->wParam)
		{
		case VK_ESCAPE:
			SetFocus();
			return TRUE;
		case 'X':
			if ((::GetKeyState(VK_CONTROL)&0x8000) > 0)
				MessageBox(_T("hello"));
			return TRUE;

		}
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}
相關文章
相關標籤/搜索