I am trying to get the hwnd of a child window(caption = "Reset") to apply in IsWindowVisible() function but the child window could not be found.
This is the code:
#include <iostream>
#include <windows.h>
using namespace std;
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
char class_name[100];
char title[100];
GetClassNameA(hwnd,class_name, sizeof(class_name));
GetWindowTextA(hwnd,title,sizeof(title));
cout <<"Window title: "<<title<<endl;
cout <<"Class name : "<<class_name<<endl;
cout <<"hwnd : " <<hwnd<<endl<<endl;
return TRUE;
}
int main()
{
HWND hwnd = ::FindWindowA("#32770",NULL);
EnumChildWindows(hwnd,EnumWindowsProc,0);
system("PAUSE");
return 0;
}
There are a lots of window with the same classname #32770 (Dialog), also without title. After run the code, the result came out different types of window (with classname like WorkerW, IME, etc.).
The tree diagram get from Spy++ are like this:
...Window 00180726 "" #32770 (Dialog)
...Window 001F0962 "Reset" Button
I tried to find the child window if window title and window class(#32770) are included, it succeed.
My question is: How to find the child window (Reset) if we don't have a specific parent window? I tried apply EnumWindows, EnumChildWindows, FindWindows, FindWindowsEx in main() but still can't get what I expect.
Advance thanks for any kind of helps.
You can use WindowFromPoint to get parent dialog if you know its position then call EnumChildWindows to get its child