Click here to Skip to main content
14,456,907 members
   

C#

 
GeneralRe: How to drag with mouse Controls groupBox1 in Run time ? Pin
Member 245846716-Oct-19 17:07
MemberMember 245846716-Oct-19 17:07 
GeneralRe: How to drag with mouse Controls groupBox1 in Run time ? Pin
Richard MacCutchan16-Oct-19 22:56
communityengineerRichard MacCutchan16-Oct-19 22:56 
Questionhow to create a text editor that reads c sharp source and display together with colors text and brackets Pin
Member 1462267414-Oct-19 22:35
MemberMember 1462267414-Oct-19 22:35 
AnswerRe: how to create a text editor that reads c sharp source and display together with colors text and brackets Pin
OriginalGriff14-Oct-19 22:46
communityengineerOriginalGriff14-Oct-19 22:46 
AnswerRe: how to create a text editor that reads c sharp source and display together with colors text and brackets Pin
Eddy Vluggen15-Oct-19 2:25
professionalEddy Vluggen15-Oct-19 2:25 
QuestionSystem.NullReferenceException Pin
Alrzini14-Oct-19 11:09
MemberAlrzini14-Oct-19 11:09 
AnswerRe: System.NullReferenceException Pin
OriginalGriff14-Oct-19 11:16
communityengineerOriginalGriff14-Oct-19 11:16 
QuestionHelp with getting Monitors (Screen) information Pin
mniceguy8114-Oct-19 7:35
Membermniceguy8114-Oct-19 7:35 
Dear CodeProject members,

Hope everyone is well, Can someone please help me with a way to get Monitor information as i needed to include in the project i'm working to collect hardware information using C#.

I get the results for one Screen but i would like to get Manufacturer, Model, Serial Number and number of screens as our company have users that have more than 4 screens.

The WMImonitorid has this information and i don't know how to use in this case.

my references are

using System;
using System.Linq;
using System.Management;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;

private void WMI_Click(object sender, EventArgs e)

ManagementObjectSearcher objSearcher = null;
ManagementObjectCollection objCollection = null;
ManagementScope objScope = null;
ObjectQuery objQuery = null;
ConnectionOptions objOptions = null;

objOptions = new ConnectionOptions();
objOptions.Impersonation = ImpersonationLevel.Impersonate;
//options.Username = "Username";
//options.Password = "Password";
//options.Authority = "NTLMDOMAIN:GVA.ICRC.Priv";


objScope = new ManagementScope("\\\\Computer\\root\\cimv2:", objOptions);
objScope.Connect();


// Monitor connected to Computer
objQuery = new ObjectQuery("SELECT * FROM Win32_DesktopMonitor");
objSearcher = new ManagementObjectSearcher(objScope, objQuery);
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_DesktopMonitor instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Description: {0}", queryObj["Description"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}



Thank you and much appreciate your help.
AnswerRe: Help with getting Monitors (Screen) information Pin
Dave Kreskowiak14-Oct-19 10:35
mveDave Kreskowiak14-Oct-19 10:35 
GeneralRe: Help with getting Monitors (Screen) information Pin
mniceguy8114-Oct-19 11:42
Membermniceguy8114-Oct-19 11:42 
GeneralRe: Help with getting Monitors (Screen) information Pin
Dave Kreskowiak14-Oct-19 12:54
mveDave Kreskowiak14-Oct-19 12:54 
GeneralRe: Help with getting Monitors (Screen) information Pin
mniceguy8114-Oct-19 12:56
Membermniceguy8114-Oct-19 12:56 
QuestionResize controls at runtime (borderless form) Pin
Member 1407482710-Oct-19 16:42
MemberMember 1407482710-Oct-19 16:42 
AnswerRe: Resize controls at runtime (borderless form) Pin
OriginalGriff10-Oct-19 21:23
communityengineerOriginalGriff10-Oct-19 21:23 
GeneralRe: Resize controls at runtime (borderless form) Pin
Member 1407482711-Oct-19 2:24
MemberMember 1407482711-Oct-19 2:24 
AnswerRe: Resize controls at runtime (borderless form) Pin
Eddy Vluggen11-Oct-19 2:29
professionalEddy Vluggen11-Oct-19 2:29 
GeneralRe: Resize controls at runtime (borderless form) Pin
Member 1407482711-Oct-19 3:25
MemberMember 1407482711-Oct-19 3:25 
GeneralRe: Resize controls at runtime (borderless form) Pin
Eddy Vluggen11-Oct-19 3:29
professionalEddy Vluggen11-Oct-19 3:29 
GeneralRe: Resize controls at runtime (borderless form) Pin
Rob Philpott11-Oct-19 4:03
MemberRob Philpott11-Oct-19 4:03 
GeneralRe: Resize controls at runtime (borderless form) Pin
Eddy Vluggen11-Oct-19 4:07
professionalEddy Vluggen11-Oct-19 4:07 
AnswerRe: Resize controls at runtime (borderless form) Pin
BillWoodruff21-Oct-19 4:49
mveBillWoodruff21-Oct-19 4:49 
Question2D Arrays Pin
LilJokez_Gaming10-Oct-19 12:27
MemberLilJokez_Gaming10-Oct-19 12:27 
AnswerRe: 2D Arrays Pin
Luc Pattyn10-Oct-19 14:11
sitebuilderLuc Pattyn10-Oct-19 14:11 
QuestionHelp with WMI Connect Remotely Pin
mniceguy819-Oct-19 5:30
Membermniceguy819-Oct-19 5:30 
AnswerRe: Help with WMI Connect Remotely Pin
Dave Kreskowiak9-Oct-19 7:47
mveDave Kreskowiak9-Oct-19 7:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.