参考MSDN中的这篇文章,有代码下载.
This article describes how to set a hook that is specific to a thread and to a hook procedure by using the mouse hook as an example. You can use hooks to monitor certain types of events. You can associate these events with a specific thread or with all of the threads in the same desktop as a calling thread.http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q318804&#3