Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Native Event Filter not working when App is run as non-admin



  • I am using Qt's nativeEventFilter mechanism and WinAPI's RegisterDeviceNotification to register to USB plug/unplug events in my application on Windows. This is not working when the application is run by double clicking the executable.

    It all works fine when I run my application from the Visual Studio Debugger (both Debug and release modes), when I run the executable from Command Prompt, and when I Run As Administrator. But when I launch the application by double clicking the MyApp.exe, even though the RegisterDeviceNotification is successful, the code never hits the nativeEventFilter(...) which is otherwise listening constantly in the other cases mentioned above.

    Is there any way to fix this without having to make the application run as Administrator by default?

    c++ windows qt


Log in to reply