User32ChangeDisplaySettingsEx Method

Changes the settings of the specified display device to the specified graphics mode.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Ansi, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static DisplaySettingsChange ChangeDisplaySettingsEx(
	string lpszDeviceName,
	ref DevMode refDevMode,
	IntPtr hWnd,
	ChangeDisplaySettingsFlags flags,
	IntPtr lParam
)

Parameters

lpszDeviceName  String
A pointer to a null-terminated string that specifies the display device whose graphics mode will change.

Only display device names as returned by EnumDisplayDevices(String, UInt32, DisplayDevice, UInt32) are valid. The lpszDeviceName parameter can be . A value specifies the default display device.

The default device can be determined by calling EnumDisplayDevices(String, UInt32, DisplayDevice, UInt32) and checking for the DISPLAY_DEVICE_PRIMARY_DEVICE flag.

refDevMode  DevMode
A pointer to a DevMode structure that describes the new graphics mode.

If refDevMode is , all the values currently in the registry will be used for the display setting.

Passing for the refDevMode parameter and 0 for the flags parameter is the easiest way to return to the default mode after a dynamic mode change.

hWnd  IntPtr
Reserved; must be Zero.
flags  ChangeDisplaySettingsFlags
Indicates how the graphics mode should be changed.
lParam  IntPtr
If flags is VideoParameters, lParam is a pointer to a VIDEOPARAMETERS structure.

Otherwise lParam must be Zero.

Return Value

DisplaySettingsChange
A DisplaySettingsChange value that specifies the operation result.

Remarks

See Also