Created
July 28, 2011 13:59
-
-
Save jaranflaath/1111600 to your computer and use it in GitHub Desktop.
WndProc override C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void WndProc(ref Message m) | |
{ | |
int message = m.Msg; | |
int wparam = 0; | |
if(m.WParam != null) | |
{ | |
wparam = m.WParam.ToInt32(); | |
} | |
if (message == WMConstants.WM_SYSCOMMAND) | |
{ | |
switch (wparam) | |
{ | |
case WMConstants.SC_MINIMIZE: | |
{ | |
Hide(); | |
return; | |
} | |
default: | |
{ | |
break; | |
} | |
} | |
} | |
else if(message == WMConstants.WM_DEVICECHANGE) | |
{ | |
switch(wparam) | |
{ | |
case WMConstants.DBT_DEVICEARRIVAL: | |
{ | |
supportedDevicesManager.CheckForNewDevices(); | |
break; | |
} | |
case WMConstants.DBT_DEVICEREMOVECOMPLETE: | |
{ | |
supportedDevicesManager.CheckForRemovedDevices(); | |
break; | |
} | |
default: | |
break; | |
} | |
} | |
base.WndProc(ref m); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment