Link to home
Start Free TrialLog in
Avatar of wyldsj
wyldsj

asked on

sample code for MsgHook32?

Hi,

  Has anybody used MsgHook32 control from Mabry before? If so, can you show me some sample codes? I can't seem to get it working. My codes are here:

Option Explicit

Private Sub Form_Load()
Msghook1.HwndHook = &HBDC
Msghook1.Message(&H3) = True
Msghook1.Message(&H5) = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
Msghook1.HwndHook = 0
End Sub

Private Sub Msghook1_Message(ByVal msg As Long, ByVal wp As Long, ByVal lp As Long, result As Long)
Label1.Caption = "i got it"
InvokeWindowProc &HBDC, msg, wp, lp
End Sub


Nothing is being printed out after I run the program...

wyldsj
ASKER CERTIFIED SOLUTION
Avatar of bin_huwairib
bin_huwairib

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wyldsj
wyldsj

ASKER

Hi huwairib:

 Thanks for your answer. Actually I need to hook some other window(not part of my application)'s message. Do you know whether that is possible? If you are sure that it is not possible by using MsgHook, let me know and I will give u a full credit :) Thanks again.

wyldsj
wyldsj,

I don't think this is possible with this control because every window has it own WindowProc call back which will handle the window messages, so this control is replacing this procedure and handle messages for the window which contain this control.

Bin Huwairib
Avatar of wyldsj

ASKER

Okay... Thanks.

Regards,
wyldsj