Is it possible to check if a keyboard and a mouse are connected to the system with Qt or any other C++ alternative? in windows
Asked
Active
Viewed 1,655 times
8
-
1Good question. I think it is not possible with Qt, hence you have to use your own platform dependent calls. Some information about this [for windows](http://stackoverflow.com/questions/7798242/keyboard-mouse-input-in-c) and [for Linux/X11](http://stackoverflow.com/questions/50182/linux-x11-input-library-without-creating-a-window) (well, not even sure you can get the availability information easily with platform specific code...) – Boris Dalstein Jul 15 '13 at 22:42
-
Still with those answers you need to click or press a key... – Alireza Soori Jul 16 '13 at 07:42
-
3Take a look at WMI programming here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394582(v=vs.85).aspx and then this class may be used to get the available keyboards: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394582(v=vs.85).aspx There's probably something similar for mouse too. Do you need to do this on other platforms as well? – TheDarkKnight Jul 16 '13 at 08:20
-
no this should be running just on windows...BTW thanks – Alireza Soori Jul 16 '13 at 08:51
1 Answers
3
I think Qt in embedded Linux can detect the plug and unplug of an USB Mouse and enable it when USB mouse is plugged in.
you can refer following links http://qt-project.org/doc/qt-4.8/qkbddriverplugin.html#details
http://qt-project.org/doc/qt-4.8/qmousedriverplugin.html#details

snehal
- 1,798
- 4
- 17
- 24