How to detect key stroke/pressing combinations and disable them



  • Hello im building full screen application , and i need to control the key stroke/pressing
    combination like : windows + d , ctrl+alt+dll , alt+tab and so on..
    what is the best way to do such handler ?



  • Platform specific code. Those keys are not even passed to an application.



  • sorry i didn't understand



  • I do not know for the others but there are certain key stroke combinations you cannot disable. CTRL+ALT+DEL is one of them.



  • ok but what about the others?



  • Alt-Tab is handled by the OS too and used to switch applications.

    Unless you want to outrage your users you should not even think about fiddling around with that key sequences!



  • i need it with users agreed , its terminal application



  • As peppe already mentioned, you will have to resort to platform specific code then. Qt provides no means to intercept this (wich is a good thing™ - IMHO).



  • ho no problem , i i know that Qt dosnt have any " automatic"
    handler for this , i juts wanted to know which best "pattern"
    or way to handle this



  • I would go for "RegisterHotKey":http://goo.gl/KAD5K, which should work for any combinations besides CTRL+ALT+DEL.

    As far as I remember there was a possibility to disable the task manager by setting HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr to DWORD:1 - perhaps this disables CTRL+ALT+DEL too.



  • im looking for Qt solution , not win32



  • Well, i thought we agreed that there is no Qt solution and that you will have to use platform specific code.
    [quote author="peppe" date="1317060189"]Platform specific code. Those keys are not even passed to an application.[/quote]
    [quote author="Volker" date="1317067782"]As peppe already mentioned, you will have to resort to platform specific code then. Qt provides no means to intercept this (wich is a good thing™ - IMHO).[/quote]
    [quote author="umen242" date="1317095537"]ho no problem , i i know that Qt dosnt have any " automatic" handler for this , i juts wanted to know which best "pattern"
    or way to handle this [/quote]



  • why there is no ? i dont understand , there is keyevents in Qt , i just need good algorithm to use it right . basically i didn't what to write something if there is already implementation



  • Probably an third-party library like "Qxt":http://libqxt.bitbucket.org/doc/tip/qxtglobalshortcut.html might provide what you are looking for.



  • [quote author="umen242" date="1317109307"]why there is no ? i dont understand , there is keyevents in Qt [/quote]

    Start reading and understanding before crying about things you cannot change. The answers have been given already.

    [quote author="peppe" date="1317060189"]Platform specific code. Those keys are not even passed to an application.[/quote]

    [quote author="Volker" date="1317065718"]Alt-Tab is handled by the OS too and used to switch applications.

    Unless you want to outrage your users you should not even think about fiddling around with that key sequences![/quote]

    And regarding the rest:

    [quote author="umen242" date="1317109307"]i just need good algorithm to use it right . basically i didn't what to write something if there is already implementation [/quote]

    You have been told multiple times that there is no platform independent means in Qt. Crying out loudly will not change this situation in any bit involved. So I suggest you save your time and start coding.



  • ok ...



  • Qt is meant to write applications that run in a platform independent way, for the most parts. There might be some that will not be handled by Qt, e.g. if you want to do some stuff that is rearly used, like hooking system events and handle them instead leaving them to the system.

    Those things must be done in an OS dependent way. QT is no 100% OS abstraction, otherwise it would have to emulate all features that windows has and Linux not on Linux and perhaps on MAC, and vice versa.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.