能力值:
( LV2,RANK:10 )
|
-
-
2 楼
改成这样了 一次取到正确的窗口句柄
typedef struct tagWNDINFO
{
DWORD dwProcessId;
HWND hWnd;
} WNDINFO, *LPWNDINFO;
HWND call_窗口_进程id取窗口句柄(DWORD dwProcessID)
{
WNDINFO wi;
wi.dwProcessId = dwProcessID;
wi.hWnd = NULL;
EnumWindows(myEnumProc, (LPARAM)&wi);
return wi.hWnd;
}
BOOL CALLBACK myEnumProc(HWND hWnd, LPARAM lParam)
{
DWORD dwProcessId;
GetWindowThreadProcessId(hWnd, &dwProcessId);
LPWNDINFO pInfo = (LPWNDINFO)lParam;
if (dwProcessId == pInfo->dwProcessId)
{
pInfo->hWnd = hWnd;
return FALSE;
}
return TRUE;
}
|
|
|