Jump to content

WinQueryWindowDC

From EDM2
Revision as of 23:37, 6 August 2023 by Martini (talk | contribs) (Created page with " This function returns the device context for a given window. ==Syntax== WinQueryWindowDC(hwnd) ==Parameters== ;hwnd (HWND) - input :Window handle. ==Returns== ;hdc (HDC...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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))
{
     /*  ...    */
}

Definition

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND    hwnd;  /*  Window handle. */
HDC     hdc;   /*  Device-context handle. */

hdc = WinQueryWindowDC(hwnd);

Related Functions

  • WinEnableWindow
  • WinIsThreadActive
  • WinIsWindow
  • WinIsWindowEnabled
  • WinQueryDesktopWindow
  • WinQueryObjectWindow
  • WinQueryWindowProcess
  • WinQueryWindowRect
  • WinWindowFromDC
  • WinWindowFromID
  • WinWindowFromPoint