According to QQ now algorithm: 30sec First use Spy to get QQ on line, offline and stealth message: Online: Windows Send WM_COMMAND message to QQ, wparam parameter is 0x00003390, LPARAM is 0 offline: Windows Send WM_COMMAND message to QQ, WPARAM parameter is 0x00003393, LParam is 0 Stealth: Windows sends a WM_COMMAND message to QQ, WPARAM parameter is 0x00003392, LParam is 0 Find the method of the main window after QQ login: 1. Use the EnumWindows enumeration window, determine if the window name is "# 32770", if so, if there is a sub-window named "tencent_qqbar" with the FINDWINDOWEX lookup window, if Presence, it will be described as QQ2. Get the top window with GetTopWindow, then getnextwindow a child window with "Tencent_QQBAR" to find a lot of other methods Now get QQ handle, you also know what kind of message sent, set the timer, sendMessage. code: #include #define Len 100 # define id_timer 1 #define qq_online 0x00003390 # define qq_stealth 0x00003392 # Define QQ_Offline 0x00003393 HWND HQQWnd; BOOL CALLBACK DlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {char sTime [LEN]; switch (message) {case WM_INITDIALOG: SetDlgItemText (hDlg, IDC_EDIT_TIME, "35"); return TRUE; break; case WM_TIMER: SendMessage (hqqWnd, WM_COMMAND, (WPARAM) QQ_OFFLINE, 0); SendMessage (hqqWnd, WM_COMMAND, (WPARAM) QQ_STEALTH, 0); break; case WM_COMMAND: switch (LOWORD (wParam)) {case IDC_START: GetDlgItemText (hDlg, IDC_EDIT_TIME, Stime, LEN); SetTimer (HDLG, ID_TIMER, ATOI (Stime) * 1000, NULL); SendMessage (HDLG, WM_TIMER, 0, 0); Break; Case IDC_Stop: KillTimer (HDLG, ID_TIMER); Break; Case IDCancel: Killtimer (HDLG, ID_TIMER); EndDialog (HDLG, 0); return true;} Break;} Return False; Bool Callback SearchQQ (HWND HWND, LPARAM LPARAM) {char classname [len] = {0}; getClassName (hWnd, classname, len); if (strcmp (classname, "# 32770") == 0) {IF (FindWindowEx hwnd, NULL, "Tencent_QQBar", NULL)) {hqqWnd = hwnd; return FALSE;}} return TRUE;} int WINAPI WinMain (hINSTANCE hInstance, hINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {/ * look for another window QQ Method of handle, don't know, and enumwindows is higher than who is efficient ... HQQWnd = getTopWindow (null); while (hqqwnd = getnextwindow (hqqwnd, gw_hwndnext) {if (FindWindowEx (HQQWnd, Null, "Tencent_QQBAR", NULL) BREAK } * / Enumwindows (Searchqq, 0); if (hqqwnd == null) {MessageBox (null, "did not find QQ, please confirm whether to open QQ!", "No QQ, exit", MB_OK; Return 0; } DialogBox (Hinstance, MakeintResource (IDD_MAINDLG), NULL, DLGPROC); RETURN 0;} This will write a tool for a brush time. But try it, it seems that there is no effect, it is estimated that the final program is changed by Tencent: dialog ID is the IDD_MAINDLG Start button ID for the IDC_Start stop button ID is IDC_STOP text box ID is IDC_EDIT_TIME, the initial value is 35