This function obtains the process identity and thread identity of the thread that created a window.
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ PPID ppid; /* Process identity of the thread that created the window. */ PTID ptid; /* Thread identity of the thread that created the window. */ BOOL rc; /* Success indicator. */ rc = WinQueryWindowProcess(hwnd, ppid, ptid);