[RESOLVED] GetActiveWindow returns 0 for games.. Why?
I'm making a program to trace which programs connect where. It works fine by listing all processes + it's windows + the connections each process has made.
However i'm trying to add a function that will tell the user which process a certaing window belongs to, and this works for all except some games.
These games ARE listed in my app WITH hWnd's and PID's and tcp connections.. but when i run "GetActiveWindow" (by letting the user press a hotkey), the functions returns 0 when the game is active.
Note that this is a game WINDOW.. not fullscreen Direct3D or anything like that.. It does use DirectDraw however.
Anyone know why the function acts this way? Any other way of getting the handle OR the PID of the active window?
Added [RESOLVED] to thread title and green "resolved" checkmark - Hack
Re: GetActiveWindow returns 0 for games.. Why?
GetActiveWindow can only return the handle of the current window belonging to the calling thread. Since the game belongs to another process you can't use that function, use the GetForegroundWindow API function instead.
Re: GetActiveWindow returns 0 for games.. Why?
Ah, that did the trick, thank you.