Created
March 2, 2015 19:38
-
-
Save NoTimeForHero/f50524c07f121f47e9fc to your computer and use it in GitHub Desktop.
Get ID from Ammy Admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <string> | |
using namespace std; | |
BOOL CALLBACK FindAmmy(HWND hwnd, LPARAM lParam); | |
BOOL CALLBACK FindAmmyChilds(HWND hwnd, LPARAM lParam); | |
const char* getAmmyData(); | |
const char* AMMY_WIN_NAME = "Ammyy Admin v3.5"; | |
string data; | |
int main() { | |
cout << getAmmyData(); | |
return 0; | |
} | |
const char* getAmmyData() { | |
EnumWindows(FindAmmy, NULL); | |
return data.c_str(); | |
} | |
BOOL CALLBACK FindAmmy(HWND hwnd, LPARAM lParam) { | |
char class_name[80]; | |
char title[80]; | |
GetClassName(hwnd,class_name, sizeof(class_name)); | |
GetWindowText(hwnd,title,sizeof(title)); | |
// Если это окно именно AMMY Admin | |
if (strncmp(title, AMMY_WIN_NAME, strlen(AMMY_WIN_NAME)) == 0) { | |
/* | |
cout << "HWND: " << hwnd << endl; | |
cout <<"Window title: "<<title<<endl; | |
cout <<"Class name: "<<class_name<<endl<<endl; | |
*/ | |
EnumChildWindows(hwnd, FindAmmyChilds, 0); | |
} | |
} | |
BOOL CALLBACK FindAmmyChilds(HWND hwnd, LPARAM lParam) { | |
char class_name[80]; | |
char title[80]; | |
GetClassName(hwnd,class_name, sizeof(class_name)); | |
GetWindowText(hwnd,title,sizeof(title)); | |
char text[4096]; | |
if (strncmp(class_name, "Edit", 4) == 0) { | |
SendMessage(hwnd, WM_GETTEXT, sizeof(text), LPARAM(text)); | |
/* | |
cout << "HWND: " << hwnd << endl; | |
cout <<"Window title: "<<title<<endl; | |
cout <<"Class name: "<<class_name<<endl<<endl; | |
*/ | |
// string = string + char + const char; | |
data = data + text + "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment