예제 #1
0
    protected WindowsHook(HookType idHook, HookScope scope)
    {
        this.lpfn = this.OnWindowsHook;

        switch (scope)
        {
        case HookScope.LowLevelGlobal:
            this.hhk = SafeHookHandle.SetWindowsHook(idHook, this.lpfn, IntPtr.Zero, 0U);
            return;

        default:
            throw new InvalidEnumArgumentException("scope", (int)scope, typeof(HookScope));
        }
    }
예제 #2
0
    protected WindowsHook(HookType idHook, HookScope scope)
    {
        this.lpfn = this.OnWindowsHook;

        switch (scope)
        {
        case HookScope.LowLevelGlobal:
            IntPtr moduleHandle = NativeMethods.GetModuleHandle(null);
            this.hhk = SafeHookHandle.SetWindowsHook(idHook, this.lpfn, moduleHandle, 0U);
            return;

        default:
            throw new InvalidEnumArgumentException("scope", (int)scope, typeof(HookScope));
        }
    }