The running interface is as follows:
Two notes:
Implementation of this function in C + + is very simple, there are many classic examples can be achieved, in C # There are many problems will occur.
For the hook is not familiar with the knowledge can refer to another article I reproduced: http://www.cnblogs.com/hocylan/articles/1033895.html[Microsoft Hook Technical Topic]
Three approximate steps
The main thing is to call the Windows API
Step One: Install hooks: SetWindowsHookEx (wh_codes idhook, HookProc lpfn,intptr pinstance, int threadId);
Step two: Callback and processing CallNextHookEx (IntPtr phookhandle, int ncode,int32 wParam, IntPtr lParam);
Step three: Complete the ordinary business process other processes
Apply the encapsulated hooks to the system ....
private void start_Click(object sender, EventArgs e)
{hook_Main.InstallHook("1");}
private void stop_Click(object sender, EventArgs e)
{this.hook_Main.UnInstallHook();}
private void stopkeyboard_Click(object sender, EventArgs e)
{ hook_Main.InstallHook("2"); }
Fourth step: Remove Hook UnhookWindowsHookEx (IntPtr phookhandle);