Vista bug? SetWindowsHookEx(KEYBOARD) failed

2009-03-31
2012-11-13
  • Matt Dunphy
    Matt Dunphy
    2009-03-31

    I just upgraded my system at work and am now running Vista, where I've encountered a few issues regarding permissions when I'm logged in under my domain account, but nothing really worth bothering anyone with yet.

    However... unrelated to permissions -

    When I do a search, then click the top of the results window to move it, every time I get "SetWindowsHookEx(KEYBOARD) failed" and I have trouble clicking on anything until I can end the Notepad++ process. How can I help fix this bug?

     
    • Matt Dunphy
      Matt Dunphy
      2009-03-31

      Addendum: An alert sometimes appears that says
      GetLastError() Returned 1428

       
    • Jugoslav Dujic
      Jugoslav Dujic
      2009-04-01

      1428: Cannot set nonlocal hook without a module handle. ERROR_HOOK_NEEDS_HMOD

      If you feel like debugging it (I don't have time at the moment)... Without looking at the code, I'd say that Npp wants to set a local hook with SetWindowsHookEx, and gives NULL for the module handle (as it should). However, the first argument (dwThreadId) in that case should be set to a local thread ID (probably GetCurrentThreadId()), but it gets screwed in the process (probably NULL somehow).

       
      • Don HO
        Don HO
        2009-04-02

        > the first argument (dwThreadId) in that case should be set to a local thread ID (probably GetCurrentThreadId()),
        > but it gets screwed in the process (probably NULL somehow).

        Thank you for the psychic debugging, the bug should be fixed now.

        Please send a mail to :
        d o n . h @ f r e e . f r
        if you want to test the fixed binary.

        Don

         
        • Don HO
          Don HO
          2009-04-07

          Just tested, the solution provided above doesn't work at all.

          Don