Show / Hide Table of Contents

Method WinEventHook.Hook(+ 1 overload)


Overload

Sets a hook for an event or a range of events.

public void Hook(EEvent eventMin, EEvent eventMax = 0, int idProcess = 0, int idThread = 0, EHookFlags flags = EHookFlags.None)
Parameters
eventMin  (EEvent)

The lowest event constant value in the range of events. Can be EEvent.MIN to indicate the lowest possible event value. Events reference: SetWinEventHook. Value 0 is ignored.

eventMax  (EEvent)

The highest event constant value in the range of events. Can be EEvent.MAX to indicate the highest possible event value. If 0, uses eventMin.

idProcess  (int)

The id of the process from which the hook function receives events. If 0 - all processes on the current desktop.

idThread  (int)

The native id of the thread from which the hook function receives events. If 0 - all threads.

flags  (EHookFlags)
Exceptions
InvalidOperationException

Hooks are already set and WinEventHook.Unhook not called.

AuException

Failed.

Examples

See WinEventHook.


Overload(top)

Sets multiple hooks.

public void Hook(EEvent[] events, int idProcess = 0, int idThread = 0, EHookFlags flags = EHookFlags.None)
Parameters
events  (EEvent[])

Events. Reference: API SetWinEventHook. Elements with value 0 are ignored.

idProcess  (int)

The id of the process from which the hook function receives events. If 0 - all processes on the current desktop.

idThread  (int)

The native id of the thread from which the hook function receives events. If 0 - all threads.

flags  (EHookFlags)
Exceptions
InvalidOperationException

Hooks are already set and WinEventHook.Unhook not called.

AuException

Failed.

Examples

See WinEventHook.