tags:

views:

295

answers:

5

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

A: 

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

sql_mommy
It's Screen.PrimaryScreen.DeviceName (atleast in 3.5). However it will also just return ".\Device1".
Ezombort
That's what I'm using, and it's not returning the desired results :(
devoured elysium
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!
sql_mommy
A: 

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
Windows itself recognizes the screens' true names in all other places, it must know the rael names itself.
devoured elysium
A: 

My nVidia driver recognizes my displays as what they actually are.

Chrisb
A: 

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

ongle
+3  A: 

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