Skip to content

Instantly share code, notes, and snippets.

@jaranflaath
Created August 1, 2011 17:59
Show Gist options
  • Save jaranflaath/1118644 to your computer and use it in GitHub Desktop.
Save jaranflaath/1118644 to your computer and use it in GitHub Desktop.
WndProc
protected override void WndProc(ref Message m)
{
Thread.Sleep(100);
switch(m.Msg) {
case WMConstants.WM_SYSCOMMAND:
if(m.WParam.ToInt32() == WMConstants.SC_MINIMIZE)
{
Hide();
return;
}
else
{
break;
}
case WMConstants.WM_DEVICECHANGE:
if(m.WParam.ToInt32() == WMConstants.DBT_DEVICEARRIVAL)
{
supportedDevicesManager.CheckForNewDevices();
return;
}
else if(m.WParam.ToInt32() == WMConstants.DBT_DEVICEREMOVECOMPLETE)
{
supportedDevicesManager.CheckForRemovedDevices();
return;
}
else
{
break;
}
}
base.WndProc(ref m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment