summaryrefslogtreecommitdiff
path: root/devicelist/Program.cs
diff options
context:
space:
mode:
authorTomáš Pazdiora <[email protected]>2021-01-05 03:46:57 +0100
committerTomáš Pazdiora <[email protected]>2021-01-05 04:38:22 +0100
commit3f12802a19f93fec99b5186b0d39c3fa2f783c6a (patch)
tree793aa5cb234caa5e1cbc39bff7fb4b148c246561 /devicelist/Program.cs
parentfix .rc files (diff)
downloadrawaccel-3f12802a19f93fec99b5186b0d39c3fa2f783c6a.tar.xz
rawaccel-3f12802a19f93fec99b5186b0d39c3fa2f783c6a.zip
add devicelist app
Diffstat (limited to 'devicelist/Program.cs')
-rw-r--r--devicelist/Program.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/devicelist/Program.cs b/devicelist/Program.cs
new file mode 100644
index 0000000..6ac08f6
--- /dev/null
+++ b/devicelist/Program.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Text;
+using System.Management;
+using System.Windows.Forms;
+
+namespace devicelist
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ ManagementObjectSearcher searcher = new ManagementObjectSearcher(new SelectQuery("Win32_PnPEntity"));
+
+ foreach (ManagementObject obj in searcher.Get())
+ {
+ if (obj["PNPClass"].ToString() == "Mouse" && obj["HardwareID"] != null) {
+ String[] hwidArray = (String[])(obj["HardwareID"]);
+ String hwid = hwidArray[0].ToString().Replace(@"\", @"\\");
+ String caption = "(" + obj["Name"].ToString() + ") Device Hardware ID:";
+ if (MessageBox.Show(hwid, caption, MessageBoxButtons.OKCancel) == DialogResult.Cancel) {
+ break;
+ }
+ }
+ }
+ }
+ }
+}