HWND pParent = ::GetDesktopWindow(); //(HWND)0x001205A8;
HWND pchild = ::GetWindow(pParent,GW_CHILD);
bool b = false;
while (IsWindow(pchild))
{
::GetWindowText(pchild,buf,MAX_SIZE);
if (pchild)
{
if (wcscmp(_T("multiple"),buf) == 0)
{
pchild = ::GetWindow(pchild,GW_CHILD);
m_Dis += buf;
::GetClassName(pchild,buf,MAX_SIZE);
m_className += buf;
b = true;
continue;
}
}
if (b)
{
m_Dis += buf;
::GetClassName(pchild,buf,MAX_SIZE);
m_className += buf;
}
pchild = ::GetWindow(pchild,GW_HWNDNEXT);
}
void TraversalHnadleOfWindow(const wchar_t *pName)
{
HWND pParent = (HWND)0x000709EE;//::GetDesktopWindow();
CString strlog;
SearchHandl(strlog,pParent);
}
static void SearchHandl(CString &strlog,HWND hchild)
{
if (!hchild) return;
hchild = ::GetWindow(hchild,GW_CHILD);
SearchHandl(strlog,hchild);
wchar_t buf[MAX_PATH];
const wchar_t Log[] = L"E:\\findcon.txt";
WriteLog(xu::CStrToStr(Log).c_str(),"--------------level--------------\n",true);
while (::IsWindow(hchild)){
::GetWindowText(hchild,buf,MAX_PATH);
strlog = "cText: ";
strlog += buf;
::GetClassName(hchild,buf,MAX_PATH);
strlog += " cName: ";
strlog += buf;
strlog += "\n";
WriteLog(xu::CStrToStr(Log).c_str(),xu::CStrToStr(strlog).c_str(),true);
hchild = ::GetWindow(hchild,GW_HWNDNEXT);
}
}