The GetWindowTask function is now obsolete. It has been replaced by the GetWindowThreadProcessId function.
GetWindowTask is macroed onto the GetWindowThreadProcessId function to maintain compatibility for older applications. They may continue to call GetWindowTask as previously documented. New Windows32 applications should use GetWindowThreadProcessId .
GetWindowTask was defined as returning a HANDLE. GetWindowThreadProcessId returns a DWORD. The macro that maps GetWindowTask onto GetWindowThreadProcessId includes a cast to a HANDLE.
This is how GetWindowTask is macroed onto GetWindowThreadProcessId:
#define GetWindowTask(hwnd)\
((HANDLE)GetWindowThreadProcessId(hwnd, NULL))
GetWindowThreadProcessId