Title bar text from child window of MDI App
Title bar text from child window of MDI App
(OP)
Hi all,
I need to be able to obtain the text from the title bar of a child window of a seperate MDI application.
Any help would be much appreciated; and thanks in advance.
I need to be able to obtain the text from the title bar of a child window of a seperate MDI application.
Any help would be much appreciated; and thanks in advance.
RE: Title bar text from child window of MDI App
In the EnumWindowProc or EnumChildProc you can pass your own type (AKA ProcessInfo_t)....
ProcessInfo_t * processInfo;
processInfo = reinterpret_cast<ProcessInfo_t*>(lParam);
In the header file of the C++ app add the following:
bool CBogusDlg::FindDesiredWindow(UINT state);
static BOOL WINAPI EnumWindowsProc(HWND hwnd, LPARAM lParam);
static BOOL WINAPI EnumChildProc(HWND hwnd, LPARAM lParam);
In the cpp file add:
bool CBogusDlg::FindDesiredWindow(UINT state)
{
int bogus;
// If a name wasn't supplied, don't bother.
EnumWindows(EnumWindowsProc, (LPARAM)(&bogus));
return false;
}
BOOL WINAPI CBogusDlg::EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
int bogus;
// char title[100];
EnumChildWindows(hwnd, EnumChildProc, (LPARAM)(&bogus));
// ::GetWindowText(hwnd, title, 100);
return 1;
}
BOOL WINAPI CBogusDlg::EnumChildProc(HWND hwnd, LPARAM lParam)
{
char title[100];
::GetWindowText(hwnd, title, 100);
TRACE("%s\n", title);
return 1;
}