public void Start() { if (!this._isStarted && this._hookType != 0) { this._hookCallback = new GlobalHook.HookProc(this.HookCallbackProcedure); this._handleToHook = GlobalHook.SetWindowsHookEx(this._hookType, this._hookCallback, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0); if (this._handleToHook != 0) { this._isStarted = true; } } }
public void Start() { if (this._isStarted || this._hookType == 0) { return; } this._hookCallback = new GlobalHook.HookProc(this.HookCallbackProcedure); this._handleToHook = GlobalHook.SetWindowsHookEx(this._hookType, this._hookCallback, GlobalHook.GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName), 0); if (this._handleToHook == 0) { return; } this._isStarted = true; }
protected static extern int SetWindowsHookEx(int idHook, GlobalHook.HookProc lpfn, IntPtr hMod, int dwThreadId);