可以用<br>GetWindowThreadProcessId(WindowsHandle,ProcessID_Piont);<br>{<br>The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. This function supersedes the GetWindowTask function. <br>DWORD GetWindowThreadProcessId(<br> HWND hWnd, // handle of window<br> LPDWORD lpdwProcessId // address of variable for process identifier<br> <br>Parameters<br> hWnd: Identifies the window. <br> lpdwProcessId: Points to a 32-bit value that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the 32-bit value; otherwise, it does not. <br><br>Return Values<br> The return value is the identifier of the thread that created the window. <br><br>Remarks<br><br>This function replaces the GetWindowTask function of Windows version 3.x
The GetFocus function retrieves the handle of the window that has the keyboard<br> focus, if the window is associated with the calling thread's message queue. <br>HWND GetFocus(VOID)<br><br>MSDN 中有hasFocus 方法,但是好像Delphi里边没有提供!用GetFocus可以判断