Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Keyboard hook

Keyboard hook

Scheduled Pinned Locked Moved C / C++ / MFC
comquestion
4 Posts 3 Posters 24 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phil McGahan
    wrote on last edited by
    #1

    Does anyone have experience with keyboard hooks? I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus. However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages. What I think I need is some way to force the keyboard hook to the top of the message chain. I would like to start a dialog with anyone that has worked with keyboard hooks before. Thank you. PMCGAHAN@UCSWORKS.COM

    U L 2 Replies Last reply
    0
    • P Phil McGahan

      Does anyone have experience with keyboard hooks? I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus. However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages. What I think I need is some way to force the keyboard hook to the top of the message chain. I would like to start a dialog with anyone that has worked with keyboard hooks before. Thank you. PMCGAHAN@UCSWORKS.COM

      U Offline
      U Offline
      User 1052
      wrote on last edited by
      #2

      Are you using SetWindowsHookEx? If so can I see a snippet of the code you are using? ================== The original message was: Does anyone have experience with keyboard hooks?

      I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.

      However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.

      What I think I need is some way to force the keyboard hook to the top of the message chain.

      I would like to start a dialog with anyone that has worked with keyboard hooks before.

      Thank you.

      PMCGAHAN@UCSWORKS.COM

      L 1 Reply Last reply
      0
      • U User 1052

        Are you using SetWindowsHookEx? If so can I see a snippet of the code you are using? ================== The original message was: Does anyone have experience with keyboard hooks?

        I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.

        However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.

        What I think I need is some way to force the keyboard hook to the top of the message chain.

        I would like to start a dialog with anyone that has worked with keyboard hooks before.

        Thank you.

        PMCGAHAN@UCSWORKS.COM

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Here is the ghHook = SetWindowsHookEx(WH_KEYBOARD, &KeyboardProc, ghInstance, NULL); Since I reported the problem, I believe I have found an answer. I am using SendMessage(ghWnd, gnKeyMsg, wParam, lParam); to get information out of keyhook. This dll attaches itself to every process in the system. One dll but many memory spaces. The problem is only the exe that launches the dll sets the value of hgWnd, in all other memory spaces it is NULL. I think what I need to do is set this value in the registery and read it into each memory space. What do you think. Thank you. ================== The original message was: Are you using SetWindowsHookEx? If so can I see a snippet of the code you are using?

        ==================
        The original message was:

        Does anyone have experience with keyboard hooks?

        I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.

        However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.

        What I think I need is some way to force the keyboard hook to the top of the message chain.

        I would like to start a dialog with anyone that has worked with keyboard hooks before.

        Thank you.

        PMCGAHAN@UCSWORKS.COM

        1 Reply Last reply
        0
        • P Phil McGahan

          Does anyone have experience with keyboard hooks? I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus. However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages. What I think I need is some way to force the keyboard hook to the top of the message chain. I would like to start a dialog with anyone that has worked with keyboard hooks before. Thank you. PMCGAHAN@UCSWORKS.COM

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi, you can use universal message filters and look for keyboard messagers. I tried other ways too, but no one works. I the sample file you can replace ::GetCurrentThreadId() by NULL to have a system-wide filter. ================== The original message was: Does anyone have experience with keyboard hooks?

          I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.

          However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.

          What I think I need is some way to force the keyboard hook to the top of the message chain.

          I would like to start a dialog with anyone that has worked with keyboard hooks before.

          Thank you.

          PMCGAHAN@UCSWORKS.COM

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups