CDC::CreateDC

Syntax

BOOL CreateDC( const char FAR* lpDriverName, const char FAR* lpDeviceName, const char FAR* lpOutput, LPSTR lpInitData );

Parameters

lpDriverName

Points to a null-terminated string that specifies the MS-DOS filename (without extension) of the device driver (for example, EPSON). You can also pass a CString object for this parameter.

lpDeviceName

Points to a null-terminated 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. You can also pass a CString object for this parameter.

lpOutput

Points to a null-terminated string that specifies the MS-DOS file or device name for the physical output medium (file or output port). You can also pass a CString object for this parameter.

lpInitData

Points to a DEVMODE structure containing device-specific initialization data for the device driver. The Windows ExtDeviceMode function 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.

The DEVMODE structure has the following form:

#include <drvinit.h>

typedef struct _devicemode {

char dmDeviceName[32];

WORD dmSpecVersion;

WORD dmDriverVersion;

WORD dmSize;

WORD dmDriverExtra;

DWORD dmmembers;

short dmOrientation;

short dmPaperSize;

short dmPaperLength;

short dmPaperWidth;

short dmScale;

short dmCopies;

short dmDefaultSource;

short dmPrintQuality;

short dmColor;

short dmDuplex;

} DEVMODE;

Remarks

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.

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

Return Value

TRUE if successful; otherwise FALSE.

See Also

::ExtDeviceMode, ::CreateDC