Hi Yanhong,
I believe that Alex should implement Global Hook instead of the one
associated to a specific thread. However, Microsoft .NET Framework does not
support Global Hook. That is, we are not able to use C# to implement it.
The KB article 318804 discusses this issue in detail:
HOW TO: Set a Windows Hook in Visual C# .NET
http://support.microsoft.com/?kbid=318804
"You cannot implement global hooks in Microsoft .NET Framework. To install
a global hook, a hook must have a native dynamic-link library (DLL) export
to inject itself in another process that requires a valid, consistent
function to call into. This requires a DLL export, which .NET Framework
does not support. Managed code has no concept of a consistent value for a
function pointer because these function pointers are proxies that are built
dynamically."
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! ¨C
www.microsoft.com/security
This posting is provided Ħ°as isĦħ with no warranties and confers no rights.