manud31
Messages postés81Date d'inscriptionvendredi 28 octobre 2005StatutMembreDernière intervention16 mai 2006
-
13 déc. 2005 à 23:26
PCPT
Messages postés13272Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 2018
-
14 déc. 2005 à 13:57
Bonsoir,
Voilà, mon problème:
Je cache une feuille (userform.hide)
Ensuite j'utilise une boucle, et je voudrais qu'elle s'arrête quand l'utilisateur appui sur la touche enter, et faire apparaître la feuille.
Do while not (keypress......?)
.....
loop
userform.show
Sniper_Vgaerr
Messages postés113Date d'inscriptionjeudi 2 décembre 2004StatutMembreDernière intervention14 août 2006 14 déc. 2005 à 11:33
Salut,
Exact DarKSidious, il faut que tu utilises GetAsyncKeyState :
Voici un exemple tirer de Progotop API (logiciel tirer du site de DarkSidious www.ProgOtoP.com/popapi)
'TESTE ET APPROUVE SOUS WINDOWS XP ET VB 6
'Nécessite un CommandButton nommé Command1 et un contrôle Label nommé Label1
'Ce code permet d'afficher la touche qui a été appuyé.
'Vous devez cliquer sur le bouton Command1 pour lancer la capture des touches.
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" ( ByVal vKey As Long) As Integer
Private Sub Command1_Click()
Dim a(1 To 5) As Integer
Dim k As Byte
Do
a(1) = GetAsyncKeyState(27) 'code touche Echap
a(2) = GetAsyncKeyState(37) 'code fleche gauche
a(3) = GetAsyncKeyState(38) 'code fleche haut
a(4) = GetAsyncKeyState(39) 'code fleche droite
a(5) = GetAsyncKeyState(40) 'code fleche bas
If a(1) <> 0 Then End
If a(2) <> 0 Then Label1.Caption = "gauche"
If a(3) <> 0 Then Label1.Caption = "haut"
If a(4) <> 0 Then Label1.Caption = "droite"
If a(5) <> 0 Then Label1.Caption = "bas"
For k = 1 To 5
a(k) = 0
Next k
DoEvents
Loop
End Sub