CreateIC

2.x

  HDC CreateIC(lpszDriver, lpszDevice, lpszOutput, lpvInitData)    
  LPCSTR lpszDriver; /* address of driver name */
  LPCSTR lpszDevice; /* address of device name */
  LPCSTR lpszOutput; /* address of filename or port name */
  const void FAR* lpvInitData; /* address of initialization data */

The CreateIC function creates an information context for the specified device. The information context provides a fast way to get information about the device without creating a device context.

Parameters

lpszDriver

Points to a null-terminated string that specifies the MS-DOS filename (without extension) of the device driver (for example, EPSON).

lpszDevice

Points to a null-terminated string that specifies the name of the specific device to be supported (for example, EPSON FX-80). This parameter is used if the module supports more than one device.

lpszOutput

Points to a null-terminated string that specifies the MS-DOS filename or device name for the physical output medium (file or port).

lpvInitData

Points to a DEVMODE structure that contains, initially, device-specific information necessary to initialize the device driver. The ExtDeviceMode function retrieves this structure filled in for a given device. The lpvInitData parameter must be NULL if the device driver is to use the default initialization information (if any) specified by the user through Windows Control Panel.

The DEVMODE structure has the following form:

#include <print.h>

typedef struct tagDEVMODE {   /* dm */
    char  dmDeviceName[CCHDEVICENAME];
    UINT  dmSpecVersion;
    UINT  dmDriverVersion;
    UINT  dmSize;
    UINT  dmDriverExtra;
    DWORD dmFields;
    int   dmOrientation;
    int   dmPaperSize;
    int   dmPaperLength;
    int   dmPaperWidth;
    int   dmScale;
    int   dmCopies;
    int   dmDefaultSource;
    int   dmPrintQuality;
    int   dmColor;
    int   dmDuplex;
    int   dmYResolution;
    int   dmTTOption;
} DEVMODE;

Return Value

The return value is the handle of an information context for the given device if the function is successful. Otherwise, it is NULL.

Comments

The PRINT.H header file is required if the DEVMODE structure is used.

MS-DOS device names follow MS-DOS conventions; an ending colon (:) is recommended, but optional. Windows strips the terminating colon so that a device name ending with a colon is mapped to the same port as would be the same name without a colon.

The driver and port names must not contain leading or trailing spaces.

GDI output functions cannot be used with information contexts.

When it has finished using an information context created by CreateIC, an application should remove the information context by using the DeleteDC function.

Example

The following example uses the CreateIC function to create an information context for the display and then uses the GetDCOrg function to retrieve the origin for the information context:

HDC   hdcIC;
DWORD dwOrigin;


hdcIC = CreateIC("DISPLAY", NULL, NULL, NULL);
dwOrigin = GetDCOrg(hdcIC);

DeleteDC(hdcIC);

See Also

CreateDC, DeleteDC, ExtDeviceMode