DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 
 
#include <stdio.h>
 
#include <windows.h>
 
 
 
void Click_leftmouse()
 
{
 
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
 
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
 
}
 
void Click_rightmouse()
 
{
 
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
 
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
 
}
 
void Presskey(BYTE vkey)
 
{
 
keybd_event(vkey, 0, 0, 0);
 
Sleep(50);
 
keybd_event(vkey, 0, KEYEVENTF_KEYUP, 0);
 
Sleep(50);
 
}
 
 
 
void Presskey(BYTE vkey1,BYTE vkey2)
 
{
 
keybd_event(vkey1, 0, 0, 0);
 
Sleep(50);
 
keybd_event(vkey2, 0, 0, 0);
 
Sleep(50);
 
keybd_event(vkey2, 0, KEYEVENTF_KEYUP, 0);
 
Sleep(50);
 
keybd_event(vkey1, 0, 2, 0);
 
Sleep(50);
 
}
 
int main()
 
{
 
HWND hwnd = FindWindow("TXGuiFoundation", "Shmily");
 
SetForegroundWindow(hwnd);
 
 
 
while (1)
 
{
 
hwnd = FindWindow("TXGuiFoundation", "Shmily");
 
SetForegroundWindow(hwnd);
 
//Presskey(VK_TAB);
 
//Presskey(VK_TAB);
 
//键盘模拟
 
//while (1)
 
//{
 
/* Presskey(VK_DOWN);
 
Presskey(VK_RETURN);
 
if (hwnd != GetForegroundWindow())
 
break;
 
}*/
 
Presskey(VK_CONTROL, 'V');
 
Presskey(VK_RETURN);
 
 
 
 
 
}
 
//鼠标模拟
 
//设置鼠标位置
 
SetCursorPos(0, 0);//左上角为坐标原点
 
 
 
 
 
}
 
 
 
posted on 2022-11-24 15:10  DoubleLi  阅读(64)  评论(0编辑  收藏  举报