VC++ 2008开发网络百家乐街机游戏(下)
2009-02-27 20:03:11 来源:WEB开发网(注:括弧中为键盘按键的ASCII键码值)
首先在PreTranslateMessage函数中截取键盘消息,编码如下:
BOOL CTH_ROUND_WINDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
BOOL bHandleNow = FALSE;
CString strdjs;
m_djs.GetWindowText(strdjs);
int intdjs=atoi(strdjs.operator LPCTSTR());
if(intdjs>7)
{
switch (pMsg->message)
{
case WM_KEYDOWN:
switch (pMsg->wParam)
{
//单注按键
//01
//0
case 81:
//A
case 87:
//B
case 69:
……
//01:RED-BLACK-GREEN
case 85:
case 82:
case 73:
……
//退出
case VK_RETURN:
bHandleNow = TRUE;
break;
}
if (bHandleNow)
{
OnKeyDown(pMsg->wParam, LOWORD(pMsg ->lParam), HIWORD(pMsg->lParam));
}
break;
}
}
return bHandleNow;
}
更多精彩
赞助商链接