ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

hook

 
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET
View previous topic :: View next topic  
Author Message
michaelqwerty
مهمون يكي دو روزه


Joined: 10 Mar 2007
Posts: 18

PostPosted: Mon Nov 24, 2008 12:24 pm    Post subject: hook Reply with quote

سلام می خواستم عیب این دستوراتو برام بگیرید ممنون میشم

'In a module
Private Const WH_KEYBOARD = 2
Private Const VK_SHIFT = &H10
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
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 UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Private hHook As Long
Private 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
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function
'In a form, called Form1
Private Sub Form_Load()
'set a keyboard hook
hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the windows-hook
UnhookWindowsHookEx hHook
End Sub
Back to top
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 3067
Location: Tehran

PostPosted: Wed Nov 26, 2008 8:47 am    Post subject: Reply with quote

شما پروژت رو بزار یا حداقل بگو روی کدوم خط مشکل می ده . چه خطایی می ده .
Back to top
michaelqwerty
مهمون يكي دو روزه


Joined: 10 Mar 2007
Posts: 18

PostPosted: Wed Nov 26, 2008 9:52 am    Post subject: Reply with quote

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Invalid use of AddressOf operator
---------------------------
OK Help
---------------------------
و از این خطا می گیره: AddressOf KeyboardProc
Back to top
michaelqwerty
مهمون يكي دو روزه


Joined: 10 Mar 2007
Posts: 18

PostPosted: Wed Nov 26, 2008 10:01 am    Post subject: Reply with quote

مشکلم حل شد دلیلش این بود که قسمتی از کد رو
داخل ماژول نزاشته بودم ممنون آقا وحید
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum