gpi12.hlp (Table of Contents; Topic list)
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.
DevCloseDC (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DEV
 
HMF DevCloseDC(hdc)
HDC hdc;    /* device-context handle */
 
The DevCloseDC function closes the specified device context. If the device
context is associated with a presentation space or was created by using the
WinOpenWindowDC function, an error occurs and the device context is not
closed. This function decrements the use count (by one) of processes that
have accessed the device context. The device context is deleted when the use
count reaches zero.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hdc        Identifies the device context. An error results if this parameter
           identifies a screen device context or is associated with a
           micro-presentation space.
 
Return Value
 
The return value is DEV_OK if the function is successful and the device
context is not a metafile device context. The return value is DEV_ERROR if
an error occurs. Any other return value specifies that the function closed a
metafile device context and returned its handle.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
the following:
 
     PMERR_DC_IS_ASSOCIATED
     PMERR_INV_HDC
     PMERR_NOT_CREATED_BY_DEVOPENDC
 
See Also
 
DevOpenDC, GpiAssociate, WinOpenWindowDC