سلام
ببینید من می خوام تو یه پروسس دیگه مثل Ymsgr هوک کنم با وی بی البته برای کی بورد ( wh_keyboard) خوب من همچین کدی نوشتم :
کد:
form1 :
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Sub Form_Load()
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, GetWindowThreadProcessId(FindWindow(vbNullString, "Sign in"), iis))
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx hHook
End Sub
module :
Public Const VK_SHIFT = &H10
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Const WH_KEYBOARD = 2
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT-S is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
'show the result
Form1.Print "Shift-S pressed ..."
End If
'MsgBox "hi"
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
اما وقتی از این کد استفاده می کنم یاهو مسنجر هنگ می کنه .
کسی می تونه همچین کدی با وی بی بنویسه ؟
یک صدام نادون هزار عاقل کشانده در ره باطل یکی قاتل یکی مقتول در این دریای بیحاصل با این دستگاه دوربینم جهان را پر بلا بینم جهان بهر صفا باشد به غیر آن خطا باشد آدمکشی چرا باشد مگر که در جهان بین الملل نیست که از رحم و مروت هیچ خبر نیست ؟