postmessage发送按键消息应该填什么参数?
我百度查出来是这几个参数,但是编译器说VK_ZVK_QVK_WVK_E未定义,那参数应该是什么?我要实现的是,当键盘按下Z时,程序广播按键QWE。正确参数是什么error...
我百度查出来是这几个参数,但是编译器说VK_Z VK_Q VK_W VK_E 未定义,那参数应该是什么?
我要实现的是,当键盘按下Z时,程序广播按键 Q W E。正确参数是什么
error C2065: 'VK_Z' : undeclared identifier
error C2065: 'VK_Q' : undeclared identifier
error C2065: 'VK_W' : undeclared identifier
error C2065: 'VK_E' : undeclared identifier
下面是函数
LRESULT OnPress (HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
if (wParam==VK_Z)
{
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_Q, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_Q, 0);
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_W, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_W, 0);
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_E, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_E, 0);
}
return TRUE;
} 展开
我要实现的是,当键盘按下Z时,程序广播按键 Q W E。正确参数是什么
error C2065: 'VK_Z' : undeclared identifier
error C2065: 'VK_Q' : undeclared identifier
error C2065: 'VK_W' : undeclared identifier
error C2065: 'VK_E' : undeclared identifier
下面是函数
LRESULT OnPress (HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
if (wParam==VK_Z)
{
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_Q, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_Q, 0);
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_W, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_W, 0);
PostMessage (HWND_BROADCAST,WM_KEYDOWN, VK_E, 0) ;
PostMessage (HWND_BROADCAST,KEYEVENTF_KEYUP, VK_E, 0);
}
return TRUE;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询