前面看到有人回答是GetWindowThreadProcessId
但是查了一下MSDN,这个函数返回的应该是进程的identifier,而不是handle
DWORD GetWindowThreadProcessId(
HWND hWnd, 
LPDWORD lpdwProcessId );