Win32: register for all device changes, ignore problematic message

This commit is contained in:
OV2 2016-10-20 21:44:11 +02:00
parent 1661fc838c
commit 09df5e1406
1 changed files with 7 additions and 1 deletions

View File

@ -2712,7 +2712,7 @@ LRESULT CALLBACK WinProc(
break;
#endif
case WM_DEVICECHANGE:
if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE || wParam == DBT_DEVNODES_CHANGED)
if(wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE)
PostMessage(hWnd, WM_SCANJOYPADS, 0, 0);
break;
case WM_SCANJOYPADS:
@ -3412,6 +3412,12 @@ int WINAPI WinMain(
SetMenu (GUI.hWnd, NULL);
}
DEV_BROADCAST_DEVICEINTERFACE notificationFilter;
ZeroMemory(&notificationFilter, sizeof(notificationFilter));
notificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
notificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
RegisterDeviceNotification(GUI.hWnd, &notificationFilter, DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
InitRenderFilters();
GUI.ControlForced = 0xff;