Thanks in advance for your help.
I am wondering how I might go about accessing the screen resolutions available on a user's PC. I would like to get a list of all available resolutions and also determine what the user is current running at.
Thanks in advance for your help.
I am wondering how I might go about accessing the screen resolutions available on a user's PC. I would like to get a list of all available resolutions and also determine what the user is current running at.
I believe you can make a PInvoke call to EnumDisplaySettings api call in User32.dll.
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings (string deviceName, int modeNum, ref DEVMODE devMode );
See example here.
You'll of course run into complications with dual-monitor systems, but to get the current screen you can do
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
I assumed you were talking about an executable and not an ASP.Net app, but if you need the screen size in Javascript, you can use the screen object.
screen.width; screen.height; screen.colorDepth;
You could use the Microsoft.Win32 RegestryKey class to fetch the current screen size from the registry.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles...
I'd hunt around there to find what you want, but I wouldn't mess with whatever settings they have in there.
Laramie: I think you put me on the right track!
Found this link: http://www.pinvoke.net/default.aspx/user32.enumdisplaysettings