Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Apply hook to one process?


Apply hook to one process?

Author
Message
Rohni
Rohni
Forum God
Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)Forum God (513 reputation)

Group: Forum Members
Posts: 1, Visits: 26
This is what I have so far and Im testing it out on my Vb app first but for some reason its not picking up the WM_SIZE message.



Does anyone know how I can do that or what I'm doing wrong?



Thanks



Also if I could find Keiths VB Syntax Highlighter I would use it:







Public Type MSG

hwnd As Long

message As Long

wParam As Long

lParam As Long

time As Long

pt As POINTAPI

End Type





Public Type RECT

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Public tempsize As Long

Public chromerect As RECT

Public win As Long

Public childwin As Long

Public classname As String

Public classlong As Long

Public Ret As Long



Private hMSGcb As Long

Private Const WH_GETMESSAGE As Long = 3



Private Const WM_SIZE As Long = &H5

Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" ( _

ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long

Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, _

ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long



Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _

pDest As Any, pSource As Any, ByVal cb As Long)

Private Const WM_HOTKEY As Long = &H312

Private Const WM_SIZING As Long = &H214

Private Const WH_CALLWNDPROC As Long = 4





Private Const PM_REMOVE As Long = &H1





Private Function MSGCallback(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long





If wParam Or lParam = WM_SIZE Then

MDIForm1.Caption = "Size"

End If



MSGCallback = CallNextHookEx(hMSGcb, Code, wParam, lParam)

End Function



Public Sub HookMSG()

UnhookMSG

hMSGcb = SetWindowsHookEx(WH_GETMESSAGE, AddressOf MSGCallback, App.hInstance, 0&)

'MDIForm1.Caption = "L:" & hMSGcb

End Sub



Public Sub UnhookMSG()

If hMSGcb <> 0 Then

Call UnhookWindowsHookEx(hMSGcb)

hMSGcb = 0

End If

End Sub









All of that is inside a module now could someone please explain to me why this is failing?



Thanks
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search