通过下面的代码,能够在另外一个程序中获取任务管理器的句柄,也能够获取子控件的ID,但是就是不能获取子控件的文本!望指教。。
CWnd* hWnd = FindWindow(NULL,"Windows 任务管理器");
if( NULL != hWnd )
{
CString str;
hWnd->GetWindowText(str);
MessageBox(str);
hWnd = hWnd->GetWindow(GW_CHILD);
while(hWnd)
{
int i = hWnd->GetDlgCtrlID();
str.Format("%d",i);
MessageBox(str);
//hWnd->GetDlgItemText(i,str);
//str.Format("%d",i);
//MessageBox(str);
hWnd = hWnd->GetNextWindow();
}
}
else
{
MessageBox("窗口没打开");
}