HWND* hWnd = new HWND[255];
int iLength = 0;
GetHwndByPid(PE.th32ProcessID, &hWnd, &iLength);
//进程ID取窗口句柄
bool CxxxxDlg::GetHwndByPid(DWORD ProcessId, HWND** hWnd, int* iLength)
{
bool bRet = false;
*iLength = 0;
WindowInfo WinInfo1[255];
DWORD aa=EnumWindowInfo(WinInfo1);
for(int i=0; i
if (WinInfo1[i].dwProcessId == ProcessId)
{
bRet = true;
(*hWnd)[(*iLength)] = WinInfo1[i].hwnd1;
(*iLength)++;
if (NULL == ::GetWindowLong(WinInfo1[i].hwnd1, GWL_HWNDPARENT))
{
//return WinInfo1[i].hwnd1;
}
}
}
return bRet;
}