WinQueryWindowProcess: Difference between revisions
Appearance
Created page with " This function obtains the process identity and thread identity of the thread that created a window. ==Syntax== WinQueryWindowProcess(hwnd, ppid, ptid) ==Parameters== ;hwnd..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function obtains the process identity and thread identity of the thread that created a window. | |||
==Syntax== | ==Syntax== | ||
WinQueryWindowProcess(hwnd, ppid, ptid) | WinQueryWindowProcess(hwnd, ppid, ptid) | ||
==Parameters== | ==Parameters== | ||
;hwnd (HWND) - input | ;hwnd (HWND) - input:Window handle. | ||
: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== | ==Returns== | ||
;rc (BOOL) - returns | ;rc (BOOL) - returns:Success indicator. | ||
:Success indicator. | :;TRUE:Successful completion | ||
:;TRUE | :;FALSE:Error occurred. | ||
:;FALSE | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INVALID_HWND (0x1001) | ;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified. | ||
:An invalid window handle was specified. | |||
==Example Code== | ==Example Code== | ||
This example shows how to query a window's process and use that information to add a switch entry window. | This example shows how to query a window's process and use that information to add a switch entry window. | ||
Line 30: | Line 23: | ||
#define INCL_WINWINDOWMGR | #define INCL_WINWINDOWMGR | ||
#define INCL_WINSYS | #define INCL_WINSYS | ||
#include < | #include <os2.h> | ||
HWND hwndFrame; /* window handle. */ | HWND hwndFrame; /* window handle. */ | ||
Line 44: | Line 37: | ||
strcpy( swctl.szSwtitle, szTitle); | strcpy( swctl.szSwtitle, szTitle); | ||
hsw = WinAddSwitchEntry( &swctl); | hsw = WinAddSwitchEntry( &swctl); | ||
</pre> | </pre> | ||
Latest revision as of 14:43, 4 October 2023
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);