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.Runtime.InteropServices;
namespace ICS
{
public partial class FrmMain : Form
{
#region WndProc常量
public const int WM_DEVICECHANGE = 0x219;
public const int DBT_DEVICEARRIVAL = 0x8000;
public const int DBT_CONFIGCHANGECANCELED = 0x0019;
public const int DBT_CONFIGCHANGED = 0x0018;
public const int DBT_CUSTOMEVENT = 0x8006;
public const int DBT_DEVICEQUERYREMOVE = 0x8001;
public const int DBT_DEVICEQUERYREMOVEFAILED = 0x8002;
public const int DBT_DEVICEREMOVECOMPLETE = 0x8004;
public const int DBT_DEVICEREMOVEPENDING = 0x8003;
public const int DBT_DEVICETYPESPECIFIC = 0x8005;
public const int DBT_DEVNODES_CHANGED = 0x0007;
public const int DBT_QUERYCHANGECONFIG = 0x0017;
public const int DBT_USERDEFINED = 0xFFFF;
public const int DBT_DEVTYP_OEM = 0x00000000;//OEM- or IHV-defined device type
public const int DBT_DEVTYP_PORT = 0x00000003;//Port device (serial or parallel).
public const int DBT_DEVTYP_VOLUME = 0x00000002;//Logical volume.
#endregion
[StructLayout(LayoutKind.Sequential)]
public struct DEV_BROADCASR_HDR
{
public int Size;
public int DeviceType;
public int Reserved;
}
public FrmMain()
{
InitializeComponent();
}
protected override void WndProc(ref Message