FindWindow通过关键字查找窗口标题的示例VC++源码
FindWindow通过关键字查找窗口标题的示例VC++源码//用关键字匹配需枚举窗口后用子串判断。
CWnd* CClientDlg::FindByKeyword(const CString& keyword) {
CWnd* p = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD);
while (p) {
CString title;
p->GetWindowText(title);
if (!title.IsEmpty() && title.Find(keyword) >= 0)
{
AfxMessageBox(title);
return p;
}
p = p->GetWindow(GW_HWNDNEXT);
}
return NULL;
}
页:
[1]