在知道窗口名title时,得到子窗口句柄
代码:
str为title
HWND Parent = ::FindWindowEx(AfxGetMainWnd()->m_hWnd, NULL, _T("MDICLIENT"), NULL);
HWND Child = ::FindWindowEx(Parent, NULL, NULL, str);
::BringWindowToTop(Child);
在知道句柄时,得到子窗口名字
代码:
HWND hChild = ::GetActiveWindow();
CString str;
int i = ::GetWindowText(hChild, (LPWSTR)(LPCTSTR)str, 255);
str.Format(_T("%s"), str);