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);//左上角为坐标原点
}