|
EventHelperSetWindowsHookEx Method |
Installs an application-defined hook procedure into a hook chain. You would install a hook
procedure to monitor the system for certain types of events. These events are associated
either with a specific thread or with all threads in the same desktop as the calling thread.
SetWindowsHookEx function Namespace: Xcalibur.NativeMethods.V2.EventsAssembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax [DllImportAttribute("user32.dll", CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Auto)]
public static int SetWindowsHookEx(
int idHook,
EventHelperHookProc hookProc,
IntPtr hookHandle,
int threadId
)
<DllImportAttribute("user32.dll", CallingConvention := CallingConvention.StdCall,
CharSet := CharSet.Auto>]
Public Shared Function SetWindowsHookEx (
idHook As Integer,
hookProc As EventHelperHookProc,
hookHandle As IntPtr,
threadId As Integer
) As Integer
public:
[DllImportAttribute(L"user32.dll", CallingConvention = CallingConvention::StdCall,
CharSet = CharSet::Auto)]
static int SetWindowsHookEx(
int idHook,
EventHelperHookProc^ hookProc,
IntPtr hookHandle,
int threadId
)
[<DllImportAttribute("user32.dll", CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Auto)>]
static member SetWindowsHookEx :
idHook : int *
hookProc : EventHelperHookProc *
hookHandle : IntPtr *
threadId : int -> int
Parameters
- idHook Int32
- The type of hook procedure to be installed.
- hookProc EventHelperHookProc
- A pointer to the hook procedure. If the dwThreadId parameter is
zero or specifies the identifier of a thread created by a different process, the lpfn
parameter must point to a hook procedure in a DLL. Otherwise, lpfn can point to a hook
procedure in the code associated with the current process.
- hookHandle IntPtr
- A handle to the DLL containing the hook procedure pointed to
by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter
specifies a thread created by the current process and if the hook procedure is within the
code associated with the current process.
- threadId Int32
- The identifier of the thread with which the hook procedure is to
be associated. For desktop apps, if this parameter is zero, the hook procedure is
associated with all existing threads running in the same desktop as the calling thread.
Return Value
Int32See Also