Gdi32CreateDC Method
Creates a device context (DC) for a device using the specified name.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("GDI32.dll", CharSet = CharSet.Ansi, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static IntPtr CreateDC(
string lpszDriver,
string lpszDevice,
string lpszOutput,
IntPtr lpInitData
)
<DllImportAttribute("GDI32.dll", CharSet := CharSet.Ansi, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function CreateDC (
lpszDriver As String,
lpszDevice As String,
lpszOutput As String,
lpInitData As IntPtr
) As IntPtr
Dim lpszDriver As String
Dim lpszDevice As String
Dim lpszOutput As String
Dim lpInitData As IntPtr
Dim returnValue As IntPtr
returnValue = Gdi32.CreateDC(lpszDriver,
lpszDevice, lpszOutput, lpInitData)
public:
[DllImportAttribute(L"GDI32.dll", CharSet = CharSet::Ansi, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static IntPtr CreateDC(
String^ lpszDriver,
String^ lpszDevice,
String^ lpszOutput,
IntPtr lpInitData
)
[<DllImportAttribute("GDI32.dll", CharSet = CharSet.Ansi, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member CreateDC :
lpszDriver : string *
lpszDevice : string *
lpszOutput : string *
lpInitData : IntPtr -> IntPtr
No code example is currently available or this language may not be supported.
- lpszDriver String
-
A pointer to a null-terminated character string that specifies either "DISPLAY" or the name of a specific display device.
For printing, we recommend that you pass to lpszDriver
because GDI ignores lpszDriver for printer devices.
- lpszDevice String
-
A pointer to a null-terminated character string that specifies the name of the specific output device being used,
as shown by the Print Manager (for example, "Epson FX-80").
It is not the printer model name. The lpszDevice parameter must be used.
To obtain valid names for displays, call EnumDisplayDevices function.
If lpszDriver is "DISPLAY" or the device name of a specific display device,
then lpszDevice must be or that same device name.
If lpszDevice is ,
then a device context (DC) is created for the primary display device.
If there are multiple monitors on the system,
calling CreateDC("DISPLAY", Nothing, Nothing, Nothing) will create a device context (DC) covering all the monitors.
- lpszOutput String
-
This parameter is ignored and should be set to .
It is provided only for compatibility with 16-bit Windows.
- lpInitData IntPtr
-
A pointer to a DevMode structure containing device-specific initialization data for the device driver.
The DocumentProperties function retrieves this structure filled in for a specified device.
The lpInitData parameter must be if the
device driver is to use the default initialization (if any) specified by the user.
IntPtr
If the function succeeds, the return value is the handle to a DC for the specified device.
If the function fails, the return value is
Zero.