473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Display device list

Hi,
I want to have a list of the display devices available on the computer, just
like the Settings tab do in the desktop properties... What I need is the
DeviceID, it's rectangle(left, top, width, height) and if it's active or
not.

Is there a built-in function to get these informations in c# using framework
2.0 or must I still use APIs?

thanks

ThunderMusic
Aug 11 '06 #1
5 2000
I think you are looking for "System.Windows.Forms.Screen.AllScreens" which
gives you a list of screens on the computer. You can then look at each of
the screens <Screenon the list for attributes. There is an example in
BOL.

Regard,
John

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:us*************@TK2MSFTNGP05.phx.gbl...
Hi,
I want to have a list of the display devices available on the computer,
just like the Settings tab do in the desktop properties... What I need is
the DeviceID, it's rectangle(left, top, width, height) and if it's active
or not.

Is there a built-in function to get these informations in c# using
framework 2.0 or must I still use APIs?

thanks

ThunderMusic

Aug 11 '06 #2
Hello ThunderMusic,

why not to enumerate manually?
http://groups.google.com/group/micro...1dc31c79274d9a

THi,
TI want to have a list of the display devices available on the
Tcomputer, just
Tlike the Settings tab do in the desktop properties... What I need is
Tthe
TDeviceID, it's rectangle(left, top, width, height) and if it's active
Tor
Tnot.
TIs there a built-in function to get these informations in c# using
Tframework 2.0 or must I still use APIs?
T>
Tthanks
T>
TThunderMusic
T>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 11 '06 #3
right, but it only displays screens attached to the desktop and I want
inactive ones too, so I can't use this solution... it would have been great
tought if it had everything...

thanks

ThunderMusic

"John J. Hughes II" <no@invalid.comwrote in message
news:uM**************@TK2MSFTNGP03.phx.gbl...
>I think you are looking for "System.Windows.Forms.Screen.AllScreens" which
gives you a list of screens on the computer. You can then look at each of
the screens <Screenon the list for attributes. There is an example in
BOL.

Regard,
John

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:us*************@TK2MSFTNGP05.phx.gbl...
>Hi,
I want to have a list of the display devices available on the computer,
just like the Settings tab do in the desktop properties... What I need is
the DeviceID, it's rectangle(left, top, width, height) and if it's active
or not.

Is there a built-in function to get these informations in c# using
framework 2.0 or must I still use APIs?

thanks

ThunderMusic


Aug 11 '06 #4
way too complicated and not even sure i'll retrieve the good information, I
prefer using PInvoke...

thanks

ThunderMusic

"Michael Nemtsev" <ne*****@msn.comwrote in message
news:17***************************@msnews.microsof t.com...
Hello ThunderMusic,

why not to enumerate manually?
http://groups.google.com/group/micro...1dc31c79274d9a

THi,
TI want to have a list of the display devices available on the
Tcomputer, just
Tlike the Settings tab do in the desktop properties... What I need is
Tthe
TDeviceID, it's rectangle(left, top, width, height) and if it's active
Tor
Tnot.
TIs there a built-in function to get these informations in c# using
Tframework 2.0 or must I still use APIs?
TTthanks
TTThunderMusic
T---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Aug 11 '06 #5
Waw... considering PInvoke and and saying System.Management is too
complicated, you have no idea how many Win32 API calls you'll need and how
many unmanaged structures you will have to convert to managed
representation, quite an error prone taks (unless you are just here to ask
for the code).

A simple call to Win32_DesktopMonitor will return all (and precise) info
you like, following is a complete sample which might change your mind

using System;
using System.Management;

public class Program {
public static void Main() {
SelectQuery query = new SelectQuery("SELECT Availability, DeviceID,
ScreenHeight , ScreenWidth FROM Win32_DesktopMonitor");
using(ManagementObjectSearcher searcher = new
ManagementObjectSearcher(query))
{
foreach(ManagementObject mo in searcher.Get())
{
Console.WriteLine("{0}, {1}, {2} - {3}",
mo.Properties["DeviceID"].Value.ToString(),
mo.Properties["Availability"].Value.ToString(), // WMI docs for
possible values 3 is running full power
mo.Properties["ScreenHeight"].Value.ToString(),
mo.Properties["ScreenWidth"].Value.ToString());
}
}
}

Willy.

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:O7**************@TK2MSFTNGP04.phx.gbl...
| way too complicated and not even sure i'll retrieve the good information,
I
| prefer using PInvoke...
|
| thanks
|
| ThunderMusic
|
| "Michael Nemtsev" <ne*****@msn.comwrote in message
| news:17***************************@msnews.microsof t.com...
| Hello ThunderMusic,
| >
| why not to enumerate manually?
| >
http://groups.google.com/group/micro...1dc31c79274d9a
| >
| THi,
| TI want to have a list of the display devices available on the
| Tcomputer, just
| Tlike the Settings tab do in the desktop properties... What I need is
| Tthe
| TDeviceID, it's rectangle(left, top, width, height) and if it's active
| Tor
| Tnot.
| TIs there a built-in function to get these informations in c# using
| Tframework 2.0 or must I still use APIs?
| TTthanks
| TTThunderMusic
| T---
| WBR,
| Michael Nemtsev :: blog: http://spaces.msn.com/laflour
| >
| "At times one remains faithful to a cause only because its opponents do
| not cease to be insipid." (c) Friedrich Nietzsche
| >
| >
|
|
Aug 22 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Omer Ahmad | last post by:
Hi All, I've been working with python for about 6 months now, and have been very impressed with the size and scope of the libraries. I have, however, run into a bit of a problem. I...
1
by: murray | last post by:
Hello, I am looking for the correct division/newsgroup within Microsoft for addressing technical USB Mouse Driver related questions. We have a simple question not answered by the USB...
10
by: minchu | last post by:
Hello, I have used CSS in HTML page (font-verdana size-8pt), looks fine in windows but in linux the fonts are corrupt and its too small. Kindly help me and tell what is the solution to correct...
2
by: DraguVaso | last post by:
Hi, In the override of the Paint-method of a DataGridTextBoxColumn I want to show an image with BitBlt, to see what I can gain there on performance. The problem is: It doesn't show me the image...
2
by: Jeremy Chapman | last post by:
Here is an example of a method I've written. I used xml comments, and the Description attribute in the hopes that I would be able to display popup info in the ide. No luck so far. Can anyone...
5
by: ThunderMusic | last post by:
Hi, I want to have a list of the display devices available on the computer, just like the Settings tab do in the desktop properties... What I need is the DeviceID, it's rectangle(left, top, width,...
2
by: Lou | last post by:
I have a class that creates an instance of the seril Port. Every thing works fine except whenever I receive data I cannot display the recieved data. I get no errors but the recived data seems to...
0
by: spira | last post by:
Hi, i'm writing a C code which would schedule some backup in linux. It takes in a device as one of its arguments. I want to check whether the device is valid for storing the backup(or if that...
10
by: blaine | last post by:
Hey everyone, So I've got a quick query for advice. We have an embedded device in which we are displaying to an LCD device that sits at /dev/screen. This device is not readily available all...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.