const int DBT_DEVTYP_VOLUME = 0x00000002; // logical volume
//[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_DEVICECHANGE &&
(m.WParam.ToInt32() == DBT_DEVICEARRIVAL ||
m.WParam.ToInt32() == DBT_DEVICEREMOVECOMPLETE ||
m.WParam.ToInt32() == DBT_DEVNODES_CHANGED))
{
if (this.Enabled)
{
Monitor.OnDeviceListChanged();
}
}
base.WndProc(ref m);
}