diff --git a/src/blackinput/win/joystickwindows.cpp b/src/blackinput/win/joystickwindows.cpp index 383e126ad..5ede8e32c 100644 --- a/src/blackinput/win/joystickwindows.cpp +++ b/src/blackinput/win/joystickwindows.cpp @@ -168,6 +168,7 @@ namespace BlackInput m_joystickDevices.clear(); m_directInput.reset(); CoUninitialize(); + destroyHelperWindow(); } void ReleaseDirectInput(IDirectInput8 *obj) @@ -252,6 +253,19 @@ namespace BlackInput return 0; } + void CJoystickWindows::destroyHelperWindow() + { + HINSTANCE hInstance = GetModuleHandle(nullptr); + + if (helperWindow == nullptr) { return; } + + DestroyWindow(helperWindow); + helperWindow = nullptr; + + UnregisterClass(helperWindowClassName, hInstance); + helperWindowClass = 0; + } + void CJoystickWindows::addJoystickDevice(const DIDEVICEINSTANCE *pdidInstance) { CJoystickDevice *device = new CJoystickDevice(m_directInput, pdidInstance, this); diff --git a/src/blackinput/win/joystickwindows.h b/src/blackinput/win/joystickwindows.h index e95583f8f..dd23dbc5a 100644 --- a/src/blackinput/win/joystickwindows.h +++ b/src/blackinput/win/joystickwindows.h @@ -123,6 +123,9 @@ namespace BlackInput //! Creates a hidden DI helper window int createHelperWindow(); + //! Destroys a hidden DI helper window + void destroyHelperWindow(); + //! Add new joystick device void addJoystickDevice(const DIDEVICEINSTANCE *pdidInstance);