Thread: Keyboardhook and Hotkey?

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    162

    Unhappy Keyboardhook and Hotkey?

    hi all,

    I have heard that you must use an dll for the windows keyboard hook apis to work in Win2000/XP in a global state, is that correct? If so then why?

    Is there any other way to "hide" or prevent applications from recieving keystroke messages? If so then how?

    Does hotkey apis prevent messages and must they always use combined keys like ctrl+..., alt+... or shift+...?

    I thank you for any reply
    Last edited by Aidman; 01-15-2003 at 08:42 AM.
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Can't you hook the keyboard, and don't call CallNextHookEx() for the keys you want to stop?
    Just a suggestion, I've never tried it..

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Keyboardhook and Hotkey?

    Originally posted by Aidman
    hi all,

    I have heard that you must use an dll for the windows keyboard hook apis to work in Win2000/XP in a global state, is that correct? If so then why?
    You need a dll because the hook function you create needs to be added to every process that you are hooking....having the code just in your program isnt good enough

    Originally posted by Aidman
    Is there any other way to "hide" or prevent applications from recieving keystroke messages? If so then how?

    Does hotkey apis prevent messages and must they always use combined keys like ctrl+..., alt+... or shift+...?

    I thank you for any reply
    If you create the hook, you can use it to filter messages, but I wont tell you how because it can be misused.

  4. #4
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    You need a dll because the hook function you create needs to be added to every process that you are hooking....having the code just in your program isnt good enough
    Does this also apply to Windows XP and NT? And what about Windows 95, 98 and ME, do they need dll declaration too?
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by Aidman
    Does this also apply to Windows XP and NT? And what about Windows 95, 98 and ME, do they need dll declaration too?
    Applies to ALL Win32 Platforms......even 95

  6. #6
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    If you only want hotkeys, use
    RegisterHotKey()
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  7. #7
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    But does HotKeys prevent key messages to other applications and must they always use combined keys like ctrl+..., alt+... or shift+...?
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Popular pages Recent additions subscribe to a feed