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.
DWORD GetWindowThreadProcessId(
HWND hWnd, |
// handle of window |
LPDWORD lpdwProcessId |
// address of variable for process identifier |
); |
The return value is the identifier of the thread that created the window.