Sous VB6.0, je souhaite remplacer la touche RETURN par la=20
touche TAB dans toutes les fen=EAtres de mon application.
Actuellement, j'utilise l' =E9v=E8nement Form_KeyPress dans=20
chcune de mes fen=EAtres de la mani=E8re suivante :
Private sub Form_KeyPress(KeyAscii as Integer)
If KeyAscii =3D vbKeyReturn then
KeyAscii =3D 0
SendKeys "{TAB}"
End If
End Sub
J'ai tent=E9 de remplacer cette gestion par un Hook dans un=20
module de code de la mani=E8re suivante :
Private hHook As Long
Public Sub Init_Hook()
hHook =3D SetWindowsHookEx(WH_KEYBOARD, AddressOf=20
KeyboardProc, App.hInstance, App.ThreadID)
End Sub
Public Sub Close_Hook()
UnhookWindowsHookEx hHook
End Sub
Private Function KeyboardProc(ByVal idHook As Long, ByVal=20
wParam As Long, ByVal lParam As Long) As Long
If idHook > -1 Then)
if wParam =3D VK_RETURN then
if (GetKeyState(VK_RETURN) and &H8000) then
... Que faire pour remplacer VK_RETURN par=20
VK_TAB =E0 ce niveau ?????
end if
End If
End if
KeyboardProc =3D CallNextHookEx(hHook, idHook, wParam,=20
ByVal lParam)
End Function