当前位置 : 主页 > 网络编程 > PHP >

C++模拟键盘输入同时按下Shift+Control+Tab键

来源:互联网 收集:自由互联 发布时间:2023-10-08
HWND chromeWnd = :: FindWindow ( L "Chrome_WidgetWin_1" , NULL ); if ( NULL != chromeWnd ) { :: SetForegroundWindow ( chromeWnd ); keybd_event ( VK_RSHIFT , 0 , 0 , 0 ); //按下Shift键 keybd_event ( VK_RCONTROL , 0 , 0 , 0 ); //按下Cont


HWND chromeWnd = ::FindWindow(L"Chrome_WidgetWin_1", NULL);
if (NULL != chromeWnd)
{
::SetForegroundWindow(chromeWnd);
keybd_event(VK_RSHIFT, 0, 0, 0);//按下Shift键
keybd_event(VK_RCONTROL, 0, 0, 0);//按下Control键
keybd_event(VK_TAB, 0, 0, 0);//按下Tab键
keybd_event(VK_RSHIFT, 0, KEYEVENTF_KEYUP, 0);//松开Shift键
keybd_event(VK_RCONTROL, 0, KEYEVENTF_KEYUP, 0);//松开Control键
keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);//松开Tab键
keybd_event(VK_RCONTROL, 0, 0, 0);//按下Control键
keybd_event(0x57, 0, 0, 0);//按下W键
keybd_event(VK_RCONTROL, 0, KEYEVENTF_KEYUP, 0);//松开Shift键
keybd_event(0x57, 0, KEYEVENTF_KEYUP, 0);//松开W键
}
上一篇:用C++创建一个简单的UDP服务端
下一篇:没有了
网友评论