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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
Okay... Thanks.
Regards,
wyldsj
Regards,
wyldsj
ASKER
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