一个玩具

觉得好玩,记录一下

 1 #include <iostream>
 2 #include <windows.h>
 3 
 4 #define path L"E:\\QQ\\Bin\\QQScLauncher.exe"
 5 #pragma   comment(linker,"/subsystem:\"windows\"  /entry:\"mainCRTStartup\""   ) 
 6 HWND hwnd;
 7 DWORD LogInQQ()
 8 {
 9     RECT r;
10     STARTUPINFO ie_si = { 0 };
11     PROCESS_INFORMATION ie_pi;
12     TCHAR SrcBuffer[256] = { 0 };
13     wsprintf(SrcBuffer, TEXT("%s"), path);
14     ie_si.cb = sizeof(ie_si);
15     DWORD P = CreateProcess(
16         NULL,
17         (LPWSTR)SrcBuffer,
18         NULL,
19         NULL,
20         FALSE,
21         NULL,
22         NULL,
23         NULL,
24         &ie_si,
25         &ie_pi
26     );
27     Sleep(3000);
28     while (TRUE)
29     {
30         hwnd = ::FindWindow(TEXT("TXGuiFoundation"), TEXT("QQ"));
31         if (hwnd != NULL)
32         {
33             break;
34         }
35         Sleep(20);
36     }
37 
38     ::GetWindowRect(hwnd,&r);
39 
40     ::SetCursorPos(r.left + 300, r.top + 250);
41 
42     mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//点下左键 
43     mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//松开左键
44     mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//点下左键 
45     mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//松开左键
46 
47     //模拟键盘
48     Sleep(200);
49     keybd_event(97, 0, 0, 0);
50     keybd_event(97, 0, KEYEVENTF_KEYUP, 0);
51     Sleep(200);
52     keybd_event(97, 0, 0, 0);
53     keybd_event(97, 0, KEYEVENTF_KEYUP, 0);
54     Sleep(200);
55     keybd_event(103, 0, 0, 0);
56     keybd_event(103, 0, KEYEVENTF_KEYUP, 0);
57     Sleep(200);

补全就可以了,自动登录qq

效果图:

 

posted @ 2021-03-29 21:05  Punished  阅读(350)  评论(0编辑  收藏  举报