CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2010
    Posts
    38

    Global Keyboard Hook

    Hi
    I am trying to set a global keyboard hook with this code:
    Code:
    case WM_CREATE:
    hHookInst = LoadLibrary(TEXT("HookProcedure.dll"));
    hHookProc = (FARPROC)GetProcAddress(hHookInst,TEXT("KHookProc"));
    hHook = SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)hHookProc,hHookInst,0);
    The problem here is that my hook works only when MY window is active and not while some other window is in the foreground.
    But isnt this supposed to be a global hook?
    Should'nt it work irrespective of any window on the foreground?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Global Keyboard Hook

    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured