Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" _
(ByVal idHook As E_idHook, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public KB_HookId As Long , ----
[code.aspx?ID=41455 Colorisation syntaxique par Renfield]
Dans un form :
Private Sub cmd_StartHooking_Click()
mod_Hooking.KB_HookId = mod_Hooking.SetWindowsHookEx(WH_KEYBOARD, AddressOf KB_HookFnc, App.hInstance, 0)
End Sub<hr />
Private Sub cmd_StopHooking_Click()
mod_Hooking.UnhookWindowsHookEx mod_Hooking.KB_HookId
End Sub<hr />Private Sub Form_Unload(Cancel As Integer)
Call cmd_StopHooking_Click
End Sub , ----
[code.aspx?ID=41455 Colorisation syntaxique par Renfield]
_______________________________________________________________________
VB.NETis good ...VB6is better
cs_ghuysmans99
Messages postés3982Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 201316 4 févr. 2008 à 08:24
Oups j'ai oublié la fonction KB_HookFnc :
Public Function KB_HookFnc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'Voici la fonction qui va traiter les messages filtrés par le hook.
Dim tmp As String
With frm_Prog
Select Case wParam
Case 8: tmp = "[BackSpace]"
Case 9: tmp = "[Tab]"
Case 13: tmp = "[Enter]"
Case 16: tmp = "[Shift]"
Case 17: tmp = "[Ctrl]"
Case 18: tmp = "[Alt]"
Case 27: tmp = "[Escape]"
Case 32: tmp = "[Space]"
Case 48 To 57: tmp = Chr(wParam)
Case 65 To 90: tmp = Chr(wParam)
Case 112 To 123: tmp = "[F*]"
Case Else
tmp = Chr(wParam) & " - " & wParam
End Select
.txt_Hooking.Text = .txt_Hooking.Text & tmp & vbCrLf KB_HookFnc -1 '-1 Null
End With
End Function , ----
[code.aspx?ID=41455 Colorisation syntaxique par Renfield]
_______________________________________________________________________
VB.NETis good ...VB6is better
SoulHnt
Messages postés3Date d'inscriptionsamedi 14 avril 2007StatutMembreDernière intervention 4 février 2008 4 févr. 2008 à 10:22
Pourriez vous ou quelqu'un faire un exemplair en code source et le uploader?
Pcq sa fait 1ans et demi jai rien fait avec VB lol, et suposement il aurait un erreur... =(
Dans le fond ce que j'aimerais avoir c'est comme un confuguration de boutton pour manette mais avec le clavier pour certain jeux que jveut jouer. Pour Definir une certaine touche a un autre.
Expl.:
Shift = Space
Ctrl = Alt
Ect...
Merci, Et Merci de Repondre Auss Vite. =D
~SoulHunter~