WinWindowFromDC: Difference between revisions
Appearance
mNo edit summary |
|||
(One intermediate revision by one other user not shown) | |||
Line 6: | Line 6: | ||
==Parameters== | ==Parameters== | ||
;hdc (HDC) - input:Device-context handle. | ;hdc (HDC) - input:Device-context handle. | ||
:The device context must first be opened by the WinOpenWindowDC function. | :The device context must first be opened by the [[WinOpenWindowDC]] function. | ||
==Returns== | ==Returns== | ||
Line 48: | Line 48: | ||
==Related Functions== | ==Related Functions== | ||
* WinEnableWindow | * [[WinEnableWindow]] | ||
* WinIsThreadActive | * [[WinIsThreadActive]] | ||
* WinIsWindow | * [[WinIsWindow]] | ||
* WinIsWindowEnabled | * [[WinIsWindowEnabled]] | ||
* WinQueryDesktopWindow | * [[WinQueryDesktopWindow]] | ||
* WinQueryObjectWindow | * [[WinQueryObjectWindow]] | ||
* WinQueryWindowDC | * [[WinQueryWindowDC]] | ||
* WinQueryWindowProcess | * [[WinQueryWindowProcess]] | ||
* WinQueryWindowRect | * [[WinQueryWindowRect]] | ||
* WinWindowFromID | * [[WinWindowFromID]] | ||
* WinWindowFromPoint | * [[WinWindowFromPoint]] | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 18:40, 14 May 2025
This function returns the handle of the window corresponding to a particular device context.
Syntax
WinWindowFromDC(hdc)
Parameters
- hdc (HDC) - input
- Device-context handle.
- The device context must first be opened by the WinOpenWindowDC function.
Returns
- hwnd (HWND) - returns
- Window handle.
- NULLHANDLE - Error occurred. For example, the device context has not been opened by the WinOpenWindowDC function.
- Other - Window handle.
Errors
Possible returns from WinGetLastError
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_INV_HDC (0x207C)
- An invalid device-context handle or (micro presentation space) presentation-space handle was specified.
Example Code
If a device context handle is specified, this example determines which window is associated with that device context.
#define INCL_WINWINDOWMGR #include <OS2.H> HWND hwnd; HDC hdc; /* Assume the device context for a window has been opened in */ /* some other window procedure. We would like to get */ /* a handle to that window. */ /* This function is called in some other window: */ /* hdc = WinOpenWindowDC(hwnd); */ hwnd = WinWindowFromDC(hdc);
Definition
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HDC hdc; /* Device-context handle. */ HWND hwnd; /* Window handle. */ hwnd = WinWindowFromDC(hdc);