How to get readable classname and title from HWND handle? in WinApi c++
Posted
by
Marko29
on Stack Overflow
See other posts from Stack Overflow
or by Marko29
Published on 2010-12-31T02:52:11Z
Indexed on
2010/12/31
2:53 UTC
Read the original article
Hit count: 172
I am using the following enumchild proc to get hwnd of each window, the problem is that i am unable to somehow detect any info from each hwnd so i can do what i want with the ones that are detected as the ones i need.
For example, how could i get window class name and the title of each window in the enum bellow?
I tried something like..
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) {
TCHAR className[MAX_PATH];
GetClassName(hwnd, cName, _countof(cName));
cout << cName;
return TRUE;
}
It just returns the hexadec handle info and every single time it is same, shouldnt the GetClassName func change the cName into new handle each time?
Also GetClassName function returns number of chars written to cName, i dont really see how this is useful to me? I need to get my cName in some readable format so i can do something like
if(cName == TEXT("classnameiamlookingfor" && hwndtitle = TEXT("thetitlethatinterestsme") DOSOMETHINGWITHIT();
But all i get here is hexadec mess.
© Stack Overflow or respective owner