Trimmed WndProc method

This commit is contained in:
Travis Nickles 2018-07-16 17:29:05 -05:00
parent a7b5b2ff35
commit a3943728e3

View File

@ -991,15 +991,16 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
private bool inHotPlug = false; private bool inHotPlug = false;
private int hotplugCounter = 0; private int hotplugCounter = 0;
private object hotplugCounterLock = new object(); private object hotplugCounterLock = new object();
private const int DBT_DEVNODES_CHANGED = 0x0007;
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{
try
{ {
if (m.Msg == ScpDevice.WM_DEVICECHANGE) if (m.Msg == ScpDevice.WM_DEVICECHANGE)
{ {
if (runHotPlug) if (runHotPlug)
{ {
Int32 Type = m.WParam.ToInt32(); Int32 Type = m.WParam.ToInt32();
if (Type == DBT_DEVNODES_CHANGED)
{
lock (hotplugCounterLock) lock (hotplugCounterLock)
{ {
hotplugCounter++; hotplugCounter++;
@ -1014,14 +1015,13 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
} }
} }
} }
catch { }
if (m.Msg == WM_QUERYENDSESSION) if (m.Msg == WM_QUERYENDSESSION)
systemShutdown = true; systemShutdown = true;
// If this is WM_QUERYENDSESSION, the closing event should be // If this is WM_QUERYENDSESSION, the closing event should be
// raised in the base WndProc. // raised in the base WndProc.
try { base.WndProc(ref m); } base.WndProc(ref m);
catch { }
} }
private void InnerHotplug2(SynchronizationContext uiContext) private void InnerHotplug2(SynchronizationContext uiContext)