using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Management;
using System.Management.Instrumentation;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//GUIの準備
MenuStrip menuStrip;
TextBox textBox1;
ToolStripButton toolStripButton1;
private void Form1_Load(object sender, EventArgs e)
{
textBox1 = new TextBox();
textBox1.Multiline = true;
textBox1.ScrollBars = ScrollBars.Both;
textBox1.Dock = DockStyle.Fill;
this.Controls.Add(textBox1);
menuStrip = new MenuStrip();
this.Controls.Add(menuStrip);
toolStripButton1 = new ToolStripButton();
toolStripButton1.Text = "実行";
toolStripButton1.Click += new EventHandler(toolStripButton1_Click);
menuStrip.Items.Add(toolStripButton1);
}
//デバイスの取得
void toolStripButton1_Click(object sender, EventArgs e)
{
toolStripButton1.Enabled = false;
textBox1.Clear();
ManagementObjectSearcher mos = new ManagementObjectSearcher(
"SELECT * FROM Win32_PnPEntity");
foreach (ManagementObject mo in mos.Get())
{
//慶安 USBチューナー : ISDB-T DTV Tuner FSUSB2N
string name = mo["Name"].ToString();
if(name.IndexOf("ISDB") >= 0)
textBox1.AppendText(name + Environment.NewLine);
}
toolStripButton1.Enabled = true;
}
}
}