how to install global WH_CBT hook

  • Thread starter Thread starter tolisss
  • Start date Start date
T

tolisss

hi

why the following works only for windows initiated from the current
thread

SetWindowsHookEx(HookType.WH_CBT, HookProc,IntPtr.Zero,0)
 
tolisss said:
hi

why the following works only for windows initiated from the current
thread

SetWindowsHookEx(HookType.WH_CBT, HookProc,IntPtr.Zero,0)

I assume HookProc is managed callback, so it's part of a managed assembly,
right?

Using managed callbacks, only WH_KEYBOARD_LL and WH_MOUSE_LL hooks can be
installed globally. All other hooks would requires the CLR (and the
HookProc's assembly) to be mapped in every process on the system, this is
not supported in .NET. Your only option is to implement your HookProc (and
preferably, also the registration/unregistration code too) in a native code
DLL (C/C++).

Willy.
 
Back
Top