public static IntPtr hookProc(int code, IntPtr wParam, IntPtr lParam) { if (code >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); if (vkCode.ToString() == Configuration.TeclaRemo) { Operations.AutoRemo(); } if (vkCode.ToString() == Configuration.TeclaInvi) { Operations.AutoInvi(); } if ((Keys)vkCode == Keys.F5) { Win32Libraries.UnHook(); Application.Exit(); } return((IntPtr)1); } else { return(CallNextHookEx(hhook, code, (int)wParam, lParam)); } }
private void timer3_Tick(object sender, EventArgs e) { if (Win32Libraries.GetAsyncKeyState(Configuration.remo) == -32767) { Operations.AutoRemo(); } if (Win32Libraries.GetAsyncKeyState(Configuration.invi) == -32767) { Operations.AutoInvi(); } Thread.Sleep(100); } // TIMER AUTOREMO/INVI
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Win32Libraries.UnHook(); }