[Mono-list] Developer Express on Linux

Nils Andresen nils at nils-andresen.de
Wed Aug 3 09:56:54 EDT 2011


Hi..
Since I recently tried doing some hooks in Windows i'll add my 2ct.

2011/8/3 Paul Johnson <paul at all-the-johnsons.co.uk>:
> http://support.microsoft.com/kb/318804 makes things clear. The only real
> swines are the low level WH_MOUSE_LL and WH_KEYBOARD_LL stuff which isn't
> supported under .NET
Actually the kb-article makes it clear that global hooks are generally
unsupported in .net - the article is about how to work around that (by
using P/Invoke).

> As for the unhook, in C++, it would be simple - delete. In C# either use the
> garbage collector methods or Finalize as part of the try/catch set up.
No. This would leave the hook in the chain and the pointer to the
hook-proc pointing somewhere - probably some already re-used space.
This will leave your Windows in a rather inconsistent state. (After
unhooking you'll still have to free/delete your used memory...)

Nils


More information about the Mono-list mailing list