I am aware of the Screen class, but when trying to use Screen.AllScreens[0], I get something like .\Device1. Instead, I'd like to have my screen's name, something like HP 24' something. How can that be done? Thanks
have you tried the DeviceName property? I think I would do Screen.getPrimaryScreen().DeviceName
http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.devicename.aspx
You may have an 'HP 24" TrueFlat Display' or whatever, but as far as windows is concerned it's almost certainly just listed as "Plug and Play Monitor", and that's it.
I think you may need to use WMI for this. Here is a a SO link. Basically you go after something like Win32_DesktopMonitor.
I think you want the Win32_DesktopMonitor class from the System.Management namespace. I'm not sure off-hand which property you want, but try something like this to see what you get:
SelectQuery q = new SelectQuery("SELECT Name, DeviceID, Description FROM Win32_DesktopMonitor");
using(ManagementObjectSearcher mos = new ManagementObjectSearcher(q))
{
foreach(ManagementObject mo in mos.Get())
{
Console.WriteLine("{0}, {1}, {2}",
mo.Properties["Name"].Value.ToString(),
mo.Properties["DeviceID"].Value.ToString(),
mo.Properties["Description"].Value.ToString());
}
}
You can filter by the specific DeviceID if you so wish with a simple "WHERE DeviceID = 'sausages'" clause in the SQL. Though perhaps with less sausage.