Programically Changing the Color Depth of the monitor
-
Hi, I'm trying to change the color depth of the user's monitor upon my app starting. I can't seem to find anything on the subject. I'm coding in 1.1 VB.Net framework. Any help would be great. Thanks
First, your app, since it's running on a shared system with other applications, should NEVER change system-wide settings like this. Second, why do you want to do this?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Hi, I'm trying to change the color depth of the user's monitor upon my app starting. I can't seem to find anything on the subject. I'm coding in 1.1 VB.Net framework. Any help would be great. Thanks
If you want to persist anyway, get prepared for some P/Invoking. There isnt a function SetDisplayColorDepth() or so; instead you need access to the following Win32 functions (below is C# syntax):
[DllImport("user32.dll")]
public static extern int EnumDisplaySettings (string deviceName,
int modeNum, ref DEVMODE1 devMode );[DllImport("user32.dll")]
public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags);for which you also would need a number of constants and the DEVMODE1 struct; then add some C# or VB code to obtain the supported settings, find the one you want, and set it. If you havent done P/Invoke before, dont bother. Try something simpler first. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }