Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Piéger une touche

1 réponse
Avatar
Jean Saint Jalmes
Bonjour,

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


Merci pour votre aide.
Jean

1 réponse

Avatar
Zoury
Salut Jean! :O)

if (GetKeyState(VK_RETURN) and &H8000) then
... Que faire pour remplacer VK_RETURN par
VK_TAB à ce niveau ?????



regarde du côté de la function SetKeyboardState()
http://groups.google.com/groups?selm=umqe9H6%24CHA.3008%40TK2MSFTNGP11.phx.gbl

--
Cordialement
Yanick Lefebvre - MVP pour Visual Basic
http://faq.vb.free.fr/?rubrique=0 - http://www.mvps.org/vbnet/
http://www.mentalis.org/agnet/apiguide.shtml - http://www.mztools.com/