gpi12.hlp (Table of Contents; Topic list)
DevOpenDC (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DEV
 
HDC DevOpenDC(hab, type, pszToken, count, pbData, hdcComp)
HAB hab;                /* anchor-block handle                     */
LONG type;              /* type of device context                  */
PSZ pszToken;           /* pointer to device-information token     */
LONG count;             /* number of elements in structure         */
PDEVOPENDATA pbData;    /* pointer to structure for device context */
HDC hdcComp;            /* handle of compatible device context     */
 
The DevOpenDC function creates a device context. This function initializes
the use count (to one) of the number of processes that have access to the
device context.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hab        Identifies the anchor block.
 
type       Specifies the type of device context. It can be one of the
           following:
 
           Value        Meaning
           ─────────────────────────────────────────────────────────────────
           OD_QUEUED    A device, such as a printer or plotter, for which to
                        queue output.
 
           OD_DIRECT    A device, such as a printer or plotter, for which to
                        not queue output.
 
           OD_INFO      Same as for OD_DIRECT, but used only to retrieve
                        information (for example, font metrics). Drawing can
                        be performed to a presentation space associated with
                        such a device context, but no output medium is
                        updated.
 
           OD_METAFILE  A device context that is used to write a metafile.
                        The graphics field defines the area of interest
                        within the metafile picture.
 
           OD_MEMORY    A device context that is used to contain a bitmap.
 
pszToken   Points to the null-terminated string that contains the
           device-information token. This device information, which is held
           in the os2.ini file, is the same as that which may be pointed to
           by the pbData parameter; any information obtained from pbData
           overrides the information obtained by using this parameter. If
           you specify an asterisk (*) for pszToken, no device information
           is taken from the os2.ini file. MS OS/2 version 1.2 acts as if
           "*" is specified but allows you to specify any string.
 
count      Specifies the number of elements in the DEVOPENSTRUC structure.
           This number may be less than the number of items in the full list
           if omitted items are irrelevant or are supplied from the
           pszToken parameter or elsewhere.
 
pbData     Points to a data area that describes the output device. This can
           be either a pointer array, or a DEVOPENSTRUC structure.
 
hdcComp    Identifies the compatible device context. When the type parameter
           is OD_MEMORY, this parameter identifies a device context that is
           compatible with the bitmaps to be used with it. If you do not
           supply this parameter or if it is NULL, the DC that MS OS/2 opens
           is compatible with the screen.
 
Return Value
 
The return value identifies the device context if the function is
successful. The return value is DEV_ERROR if the function is unsuccessful.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
the following:
 
     PMERR_INV_DC_TYPE
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_INV_DC_DATA
     PMERR_INV_HDC
 
See Also
 
DEVOPENSTRUC