2

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

devoured elysium
  • 101,373
  • 131
  • 340
  • 557
  • possible duplicate of [How do I get the actual Monitor name? as seen in the resolution dialog](http://stackoverflow.com/questions/4958683/how-do-i-get-the-actual-monitor-name-as-seen-in-the-resolution-dialog) – G.Y Jan 31 '15 at 23:44

4 Answers4

5

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.

Xiaofu
  • 15,523
  • 2
  • 32
  • 45
0

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

user158017
  • 2,891
  • 30
  • 37
0

I think you may need to use WMI for this. Here is a a SO link. Basically you go after something like Win32_DesktopMonitor.

Community
  • 1
  • 1
Donald Byrd
  • 7,668
  • 4
  • 33
  • 50
-1

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.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794