Gdi::CreateDCW_I

This method creates a device context for a device.

static WINGDIAPI HDC WINAPI CreateDCW_I(
  const WCHAR* lpszDriver,
  const WCHAR* lpszDevice,
  const WCHAR* lpszOutput,
  const DEVMODEW* lpInitData
);

Parameters

  • lpszDriver
    [in] Long pointer to a null-terminated string that specifies the file name of a driver. If you set this parameter to NULL, the system returns a screen device context.
  • lpszDevice
    Unused.
  • lpszOutput
    [in] Long pointer to an output destination. The following table shows the possible values; the colon is required when you specify a port.
    Value Description
    COMx: Serial ports; x is a number from 1 to 9.
    LPTx: Parallel ports; x is a number from 1 to 9.
    IRDA: IRDA port.
    \\servername\sharename Universal naming convention (UNC) that identifies a network printer server.
  • lpInitData
    [in] Long pointer to a DEVMODE structure that contains device-specific initialization data for the device driver. The lpInitData parameter must be NULL if you want the device driver to use the default initialization specified by the user, if any.

Return Values

The handle to a device context for the specified device indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

This method is an internal version of the CreateDC function.

Windows CE passes the lpInitData and lpszOutput parameters to the driver without modification. The lpszOutput parameter must contain a colon after the port — that is, use LPT1: or COM1:. If you do not use the colon, the connection fails.

When you no longer need the device context, call the Gdi::DeleteDC_I method to delete the device context.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Gdi.hpp.

See Also

CreateDC | Gdi::DeleteDC_I | DEVMODE

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.