Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function creates a device context (DC) for a device.
HDC CreateDC( LPCTSTR lpszDriver , LPCTSTR lpszDevice , LPCTSTR lpszOutput , CONST DEVMODE * lpInitData );
Parameters
In Windows CE versions 2.0 and 2.01, this parameter is ignored.
Value | Description |
---|---|
COM x: | Serial ports; xis a number from 1 to 9. |
LPT x: | Parallel ports; xis a number from 1 to 9. |
IRDA: | IRDA port. For Windows CE versions 2.0 and 2.01, use COM3: to specify the IRDA port. |
\\ servername\sharename | Universal naming convention (UNC) that identifies a network printer server. |
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
Windows CE passes the lpInitDataand lpszOutputparameters to the driver without modification. The lpszOutputparameter must contain a colon after the port—that is, use "LPT1:" or "COM1:"—otherwise, the connection fails.
When you no longer need the device context, call the DeleteDCfunction to delete it.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | Wingdi.h | Mgdc.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
DeleteDC, GetLastError, DEVMODE