A
arganx
Well, I'm stumped. I'm trying to find whether a child window is
visible. I have the name of the parent window and the child window. I
figured the way to do this is to first to find find the handle of the
parent window by matching the parent window name with the name that I
know. Then I could find the child window in a like manner. The
problem is - it never makes a match. Here is partial code:
char buffer[256]="";
int i=0;
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam);
int main()
{
cout << "enter target parent: " << flush;
string s;
getline(cin,s);
EnumWindows(EnumWindowsProc,0);
return 0;
} //end of main
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
GetWindowText(hwnd,buffer,256);
if(!strcmp(buffer,""))
{
return TRUE;
}
printf(" %s\n",i,buffer); // Prints fine
if (s == buffer) cout << "found it"; // Never happens!
i++;
return TRUE;
}
I've spent hours at Microsoft trying to figure it out, but can't. Any
help would be appreciated.
visible. I have the name of the parent window and the child window. I
figured the way to do this is to first to find find the handle of the
parent window by matching the parent window name with the name that I
know. Then I could find the child window in a like manner. The
problem is - it never makes a match. Here is partial code:
char buffer[256]="";
int i=0;
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam);
int main()
{
cout << "enter target parent: " << flush;
string s;
getline(cin,s);
EnumWindows(EnumWindowsProc,0);
return 0;
} //end of main
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
GetWindowText(hwnd,buffer,256);
if(!strcmp(buffer,""))
{
return TRUE;
}
printf(" %s\n",i,buffer); // Prints fine
if (s == buffer) cout << "found it"; // Never happens!
i++;
return TRUE;
}
I've spent hours at Microsoft trying to figure it out, but can't. Any
help would be appreciated.