Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
<DllImport("user32.dll")> _
Private Shared Function ChangeDisplaySettingsEx(ByVal lpszDeviceName As String, ByRef lpDevMode As DEVMODE, ByVal hwnd As IntPtr, ByVal dwflags As UInteger, ByVal lParam As IntPtr) As DISP_CHANGE
End Function
DISPLAY_DEVICE d = new DISPLAY_DEVICE();
DEVMODE dm = new DEVMODE();
d.cb = Marshal.SizeOf(d);
int deviceID=1; // This is only for my device setting. Go through the whole EnumDisplayDevices to find your device
EnumDisplayDevices(null,deviceID, ref d, 0); //
EnumDisplaySettings(d.DeviceName, 0, ref dm);
dm.dmPelsWidth = 1024;
dm.dmPelsHeight = 768;
dm.dmPositionX = Screen.PrimaryScreen.Bounds.Right;
dm.dmFields = DM.Position | DM.PelsWidth | DM.PelsHeight;
ChangeDisplaySettingsEx(d.DeviceName, ref dm, IntPtr.Zero, CDS_UPDATEREGISTRY, IntPtr.Zero);
Alternative Managed API:
Do you know one? Please contribute it!
Return values for ChangeDisplaySettings and ChangeDisplaySettingsEx
3/25/2011 11:36:01 AM - -74.46.76.243
Changes the display settings via a DEVMODE struct.
8/10/2022 6:59:36 AM - 212.105.175.123
TODO - a short description
8/8/2019 8:30:35 AM - -50.78.140.98
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).