//下面介绍下键盘按键消息:
按键要响应WM_CHAR消息
窗口过程的wParam参数就是键盘按键的具体值的ASCII码
所以如下操作可实现:
WPARAM keyChar = 0x20; //0x20是空格的ascii码,保证没有按键的时候程序正常显示......
PAINTSTRUCT stPs;
HDC hDC;
case WM_CHAR:
{
keyChar = wParam;
InvalidateRect(hWnd,NULL,TRUE);
}
break;
case WM_PAINT:
{
hDC = BeginPaint(hWnd,&stPs);
TextOut(hDC,200,200,(LPCSTR)&keyChar,1);
EndPaint(hWnd,&stPs);
break;
}