WinQueryWindowDC: Difference between revisions
Appearance
mNo edit summary |
mNo edit summary |
||
Line 14: | Line 14: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
::PMERR_INVALID_HWND (0x1001) :An invalid window handle was specified. | |||
==Remarks== | ==Remarks== | ||
A handle is returned only if a device context has been opened for the window with WinOpenWindowDC. | A handle is returned only if a device context has been opened for the window with [[WinOpenWindowDC]]. | ||
==Example Code== | ==Example Code== | ||
Line 23: | Line 23: | ||
<pre> | <pre> | ||
#define INCL_WINWINDOWMGR | #define INCL_WINWINDOWMGR | ||
#include < | #include <os2.h> | ||
HWND hwndClient; /* window handle. */ | HWND hwndClient; /* window handle. */ | ||
Line 31: | Line 31: | ||
/* ... */ | /* ... */ | ||
} | } | ||
</pre> | </pre> | ||
Line 55: | Line 44: | ||
* WinWindowFromDC | * WinWindowFromDC | ||
* WinWindowFromID | * WinWindowFromID | ||
* WinWindowFromPoint | * WinWindowFromPoint | ||
[[Category:Win]] | [[Category:Win]] |
Revision as of 21:31, 21 November 2023
This function returns the device context for a given window.
Syntax
WinQueryWindowDC(hwnd)
Parameters
- hwnd (HWND) - input
- Window handle.
Returns
- hdc (HDC) - returns
- Device-context handle.
- NULLHANDLE - Either WinOpenWindowDC has not been called for this window, or an error has occurred.
- Other - Device context handle.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001) :An invalid window handle was specified.
Remarks
A handle is returned only if a device context has been opened for the window with WinOpenWindowDC.
Example Code
This example shows how to check if WinOpenWindowDC has been called for this window.
#define INCL_WINWINDOWMGR #include <os2.h> HWND hwndClient; /* window handle. */ if(WinQueryWindowDC(hwndClient)) { /* ... */ }
Related Functions
- WinEnableWindow
- WinIsThreadActive
- WinIsWindow
- WinIsWindowEnabled
- WinQueryDesktopWindow
- WinQueryObjectWindow
- WinQueryWindowProcess
- WinQueryWindowRect
- WinWindowFromDC
- WinWindowFromID
- WinWindowFromPoint