/// <summary> /// Installs the global hook /// </summary> public void hook() { IntPtr hInstance = LoadLibrary("User32"); MouseHookProcedure = new mouseHookProc(hookProc); hhook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, hInstance, 0); }
public MouseHook(MouseCallback mouseCallback) { this.mouseHookProcDel = mouseEventCall; this.mouseCallback = mouseCallback; Hook(); }
private void Form1_Load(object sender, EventArgs e) { //lastMovement = DateTime.Now.AddDays(-1); notifyIcon1.Text = Application.ProductName; labelStatus.Text = ""; lastMovement = DateTime.Now; pos_last = Cursor.Position; labelStatus.Text = lastMovement.ToLongDateString(); comboBox1.SelectedIndex = cornerIndex; LoadSettings(); comboBox1.SelectedIndex = cornerIndex; textBoxMaxIdleSeconds.Text = maxIdleSeconds.ToString(); this.Icon = Properties.Resources.mouse_on; notifyIcon1.Icon = Properties.Resources.mouse_on; hookProcDelegate = hookProc; hook(); }
static extern IntPtr SetWindowsHookEx(int idHook, mouseHookProc callback, IntPtr hInstance, uint threadId);
public static extern IntPtr SetWindowsHookEx(int idHook, mouseHookProc callback, IntPtr hInstance, uint threadId);
private void FormFocus_Load(object sender, EventArgs e) { hookProcDelegate = hookProc; hook(); }