using System;
using System
using System
namespace WindowsApplication
public partial class Form
public Form
InitializeComponent();
}
private void Form
Win
hook
hook
}
void hook_onMouseChange(object sender
this
}
}
public class Win
[DllImport(
public static extern int GetCurrentThreadId();
[DllImport(
CallingConvention
public static extern int SetWindowsHookEx(
HookType idHook
HOOKPROC lpfn
int hmod
int dwThreadId);
public enum HookType
WH_GETMESSAGE =
}
public delegate int HOOKPROC(int nCode
public event System
public void SetHook()
SetWindowsHookEx(HookType
new HOOKPROC(this
GetCurrentThreadId());
}
public int MyKeyboardProc(int nCode
if (onMouseChange != null)
onMouseChange(null
}
return
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12209.html