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
-
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 Answers
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.

- 15,523
- 2
- 32
- 45
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

- 2,891
- 30
- 37
-
It's Screen.PrimaryScreen.DeviceName (atleast in 3.5). However it will also just return ".\Device1". – Ezombort Aug 20 '09 at 13:09
-
That's what I'm using, and it's not returning the desired results :( – devoured elysium Aug 20 '09 at 13:10
-
ok - I wasn't clear from the question and just wanted to clarify. It looks like some other people may have some ideas for you! – user158017 Aug 20 '09 at 13:15
I think you may need to use WMI for this. Here is a a SO link. Basically you go after something like Win32_DesktopMonitor.

- 1
- 1

- 7,668
- 4
- 33
- 50
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.

- 399,467
- 113
- 570
- 794
-
Windows itself recognizes the screens' true names in all other places, it must know the rael names itself. – devoured elysium Aug 20 '09 at 13:10