Windows hook demo (CppWindowsHook)

The code sample shows how to set up a Windows Hook to hook mouse and keyboard inputs in a VC++ application

C++ (109.9 KB)
4.6 Star
17,221 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

    1 Posts | Last post October 12, 2017
  • Some things are not as good as it could be...
    1 Posts | Last post April 19, 2011
    • just spotting into this sample and I found some things to make better:
      1. Why isn't ReplaceSel used to add a line to the code. It is not effective to use GetWindowtext/SetWndowText
      2. Using WM_USER+n isn't OK here. WM_USER is only allowed for private owned and created windows. For a dialog and applications WM_APP+n shouldbe used.
      Better is using a registered window message.
      3. The DLL sould protect it selfagainst multiple calls to the hook installation!
      Even for a sample this should be fixed!