WinQueryWindowProcess
Appearance
This function obtains the process identity and thread identity of the thread that created a window.
Syntax
WinQueryWindowProcess(hwnd, ppid, ptid)
Parameters
- hwnd (HWND) - input
- Window handle.
- ppid (PPID) - output
- Process identity of the thread that created the window.
- ptid (PTID) - output
- Thread identity of the thread that created the window.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Example Code
This example shows how to query a window's process and use that information to add a switch entry window.
#define INCL_WINWINDOWMGR #define INCL_WINSYS #include <os2.h> HWND hwndFrame; /* window handle. */ SWCNTRL swctl; PID pid; TID tid; HSWITCH hsw; char szTitle[] = "app.exe"; WinQueryWindowProcess( hwndFrame, &pid, &tid); swctl.hwnd = hwndFrame; swctl.idProcess = pid; strcpy( swctl.szSwtitle, szTitle); hsw = WinAddSwitchEntry( &swctl);