PrinterSettings.GetHdevmode Method

Definition

Creates a handle to a DEVMODE structure that corresponds to the printer settings.

Overloads

GetHdevmode()

Creates a handle to a DEVMODE structure that corresponds to the printer settings.

GetHdevmode(PageSettings)

Creates a handle to a DEVMODE structure that corresponds to the printer and the page settings specified through the pageSettings parameter.

GetHdevmode()

Creates a handle to a DEVMODE structure that corresponds to the printer settings.

public:
 IntPtr GetHdevmode();
public IntPtr GetHdevmode ();
member this.GetHdevmode : unit -> nativeint
Public Function GetHdevmode () As IntPtr

Returns

IntPtr

nativeint

A handle to a DEVMODE structure.

Exceptions

The printer named in the PrinterName property does not exist.

The printer's initialization information could not be retrieved.

Remarks

DEVMODE structures are device specific. Copying a DEVMODE structure from one PrinterSettings to a PrinterSettings for a different printer is not supported. When you are done with the handle that is created through this method, you must deallocate it yourself by calling the native Win32 GlobalFree method. When you call this method, you pass as a parameter the return value from the GetHdevmode method.

Applies to

GetHdevmode(PageSettings)

Creates a handle to a DEVMODE structure that corresponds to the printer and the page settings specified through the pageSettings parameter.

public:
 IntPtr GetHdevmode(System::Drawing::Printing::PageSettings ^ pageSettings);
public IntPtr GetHdevmode (System.Drawing.Printing.PageSettings pageSettings);
member this.GetHdevmode : System.Drawing.Printing.PageSettings -> nativeint
Public Function GetHdevmode (pageSettings As PageSettings) As IntPtr

Parameters

pageSettings
PageSettings

The PageSettings object that the DEVMODE structure's handle corresponds to.

Returns

IntPtr

nativeint

A handle to a DEVMODE structure.

Exceptions

The printer named in the PrinterName property does not exist.

The printer's initialization information could not be retrieved.

Remarks

DEVMODE structures are device specific. Copying a DEVMODE structure from one PrinterSettings to a PrinterSettings for a different printer is not supported.

When you are done with the handle that is created through this method, you must deallocate it yourself by calling the native Win32 GlobalFree method. When you call this method, you pass as a parameter the return value from the GetHdevmode method.

Applies to