Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
GpiQueryDevice (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_GPICONTROL
HDC GpiQueryDevice(hps);
HPS hps; /* presentation-space handle */
The GpiQueryDevice function retrieves a device-context handle for the
currently associated presentation space.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hps Identifies the presentation space.
Return Value
The return value is a handle to a device context if the function is
successful or NULL if no device context is currently associated with the
presentation space. The return value is HDC_ERROR if an error occurred.
Errors
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
PMERR_INV_HPS
PMERR_PS_BUSY
Example
This example uses the GpiQueryDevice function to retrieve a device-context
handle for the presentation space of the desktop window. The handle is used
in the DevQueryCaps function to determine the width and height of the
Presentation Manager screen.
HPS hps;
HDC hdc;
LONG lWidth, lHeight;
hps = WinGetScreenPS(HWND_DESKTOP);
hdc = GpiQueryDevice(hps);
DevQueryCaps(hdc, CAPS_WIDTH, 1L, &lWidth);
DevQueryCaps(hdc, CAPS_HEIGHT, 1L, &lHeight);
See Also
DevOpenDC, GpiAssociate, WinQueryWindowDC
♦