473,395 Members | 1,456 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,395 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 9590
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,...
0
by: adubra | last post by:
Hi there, I am using a device context (DC) and a buffer to successfully draw to screen. However, when I update the DC at very high frame rate and drag the frame containing the image very quickly...
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...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.