RuntimeCreateGetMessageHook
Creates a fresh IGetMessageHook for filtering Windows messages destined for a chosen window and (optionally) its descendants.
Syntax: RuntimeCreateGetMessageHook() As IGetMessageHook
The returned hook starts dormant. Subscribe a callback for one or more message types with RegisterMessage, then call Start to activate the subscriptions and Stop to remove them.
Warning BETA 1034
Assigning the result to a Variant without Set, as in V = RuntimeCreateGetMessageHook(), ends the program with an access violation, in a 32-bit and a 64-bit build alike. Assign it with Set, or to a variable declared As IGetMessageHook.
Example
Const WM_LBUTTONDOWN = &H201
Sub HookClicks()
Dim Hook As IGetMessageHook = RuntimeCreateGetMessageHook()
Hook.RegisterMessage Me.hWnd, AllDescendants, _
WM_LBUTTONDOWN, AddressOf OnLButtonDown
Hook.Start
End Sub