0

I'm using Easyhook to hook keystrokes, but I don't understand how Easyhook works. How to install a hook to hook KeyboardProc (callback function). This is API of the LhInstallHook:

static void LhInstallHook(
    IntPtr InEntryPoint, 
    IntPtr InHookProc, 
    IntPtr InCallback, 
    IntPtr OutHandle
)
carry
  • 11
  • 2
  • You linked to documentation, that answers your question. If that doesn't help you, it's unlikely to help you, if we repeated the documentation for you. – IInspectable Apr 25 '20 at 10:55
  • @IInspectable In [Easyhook's tutorial](http://easyhook.github.io/tutorials/nativeremotehook.html), `IntPtr InHookProc` which implemented from **`GetProcAddress(GetModule(TEXT("kernel32")), "Beep")`**. Beep is WinAPI, which is located in the kernel32 but KeyboardProc is a callback function. How to **`GetProcessAddress`** it? – carry Apr 25 '20 at 11:25
  • Sometimes it is required that you understand the underlying concepts to use a library. Start [here](https://learn.microsoft.com/en-us/windows/win32/winmsg/hooks). – IInspectable Apr 25 '20 at 12:20
  • 2
    "*I don't understand how Easyhook works*" - which is the root of your problem. You choose the wrong solution to explore. EasyHook is meant for hooking other functions, particularly Win32 API functions, it is not meant for hooking keyboard events. You need [`SetWindowsHookEx()`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexw) instead. See MSDN's documentation on [Hooks](https://learn.microsoft.com/en-us/windows/win32/winmsg/hooks) for more details – Remy Lebeau Apr 25 '20 at 20:09
  • @RemyLebeau Yup, you are right. I will start with `SetWindowsHookEx()`. Thank you for your comment – carry Apr 27 '20 at 12:26
  • If you have any question when use `SetWindowHookEx()`, please feel free to tell us. – Strive Sun Apr 28 '20 at 07:07

0 Answers0