CreateDC

Syntax

HDC CreateDC(lpDriverName,lpDeviceName,lpOutput,lpInitData)

This function creates a device context for the specified device. The lpDriverName, lpDeviceName, and lpOutput parameters specify the device driver, device name, and physical output medium (file or port), respectively.

Parameter Type/Description  
lpDriverName LPSTR Points to a null-terminated character string that specifies the DOS filename (without extension) of the device driver (for example, EpsonÒ).  
lpDeviceName LPSTR Points to a null-terminated character string that specifies the name of the specific device to be supported (for example, Epson FX-80). The lpDeviceName parameter is used if the module supports more than one device.  
lpOutput LPSTR Points to a null-terminated character string that specifies the DOS file or device name for the physical output medium (file or output port).  
lpInitData LPDEVMODE Points to a DEVMODE data structure containing device-specific initialization data for the device driver. The ExtDeviceMode retrieves this structure filled in for a given device. The lpInitData parameter must be NULL if the device driver is to use the default initialization (if any) specified by the user through the Control Panel.  

Return Value

The return value identifies a device context for the specified device if the function is successful. Otherwise, it is NULL.

Comments

DOS device names follow 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 the same name without a colon. The driver and port names must not contain leading or trailing spaces.