win32process.GetWindowThreadProcessId
int, int = GetWindowThreadProcessId(hwnd)
Retrieves the identifier of the thread and process that created the specified window.
Parameters
hwnd : int
handle to the windowReturn Value
The result is a tuple of (threadId, processId)