Hi, so basically I've got a process. In that process there is a list of running windows. I want to search ALL of the windows in that process for a certain child window. The problem is I'm not quite sure how to go at this. I'm trying to do a EnumWindows() and a EnumChildWindows() in its PROC. The reason I'm doing this is because I don't know the name of the window, or what text the window will have (if any). Once I find this certain child window I would like to somehow obtain the name of its parent window. Here is what I'm trying/have so far:
This was an example I just cooked up, the original code is too long and confusing lol. If you need anything else let me know. Thanks.Code:BOOL foundWindows = FALSE; HWND hMessageWindowATL = 0; BOOL CALLBACK EnumChildWindows(HWND hwnd, LPARAM lParam) { hMessageWindowATL = FindWindowEx(hwnd, NULL, "InputWindow", NULL); if (hMessageWindowATL) { foundWindows = TRUE; return FALSE; // stop the enumeration } return TRUE; // ^ continue enumerating if InputWindow could not be found as a child window of EnumParents enumerated window (hwnd) } BOOL CALLBACK EnumParents(HWND hwnd, LPARAM lParam) { EnumChildWindows(hwnd, &EnumChildWindows, NULL); if (hMessageWindowATL) return TRUE; return FALSE; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { if (!foundWindows) EnumWindows(&EnumParents, NULL); if (!hMessageWindowATL) return 0; else // do stuff because the target window was found }



LinkBack URL
About LinkBacks


