/// <summary> /// Subscribes to the hook and starts firing events. /// </summary> /// <exception cref="System.ComponentModel.Win32Exception"></exception> public void Start() { if (Enabled) { throw new InvalidOperationException("Hook listener is already started. Call Stop() method first or use Enabled property."); } HookCallbackReferenceKeeper = new HookCallback(HookCallback); try { HookHandle = m_Hooker.Subscribe(GetHookId(), HookCallbackReferenceKeeper); } catch (Exception) { HookCallbackReferenceKeeper = null; HookHandle = 0; throw; } }