daetips
Messages postés142Date d'inscriptionjeudi 10 juillet 2003StatutMembreDernière intervention10 novembre 2007 14 juil. 2004 à 03:48
puissant merci eyesonlyle pour la version xp (ca marche sur windows 2003 server enterprise edition
daetips
Messages postés142Date d'inscriptionjeudi 10 juillet 2003StatutMembreDernière intervention10 novembre 2007 14 juil. 2004 à 03:48
puissant merci eyesonlyle pour la version xp (ca marche sur windows 2003 server enterprise edition
eyesonlyle
Messages postés4Date d'inscriptionsamedi 22 novembre 2003StatutMembreDernière intervention 1 décembre 2003 1 déc. 2003 à 12:00
si ça marche sous win xp jv méclater, jsuis entrain de faire un tetris , ça va maider.
si ça marche merci bcp!!!!!
*bonne prog
omegad
Messages postés3Date d'inscriptionsamedi 8 novembre 2003StatutMembreDernière intervention 5 août 2004 8 nov. 2003 à 09:35
Voila la reponse pour XP, il faut utiliser sendinput, c'est plus compliqué.
cet exemple permet juste d'allumer/eteindre le bouton numlock, mais l'adapter sera facile.
' a mettre dans un module !!!
' et creer un bouton command
Public Type KEYBDINPUT
wVk As Integer
wScan As Integer
dwFlags As Long
time As Long
dwExtraInfo As Long
End Type
Public Const KEYEVENTF_KEYUP = &H2
Public Type INPUT_TYPE
dwType As Long
xi(0 To 23) As Byte
End Type
Public Const INPUT_KEYBOARD = 1
Public Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As INPUT_TYPE, _
ByVal cbSize As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source _
As Any, ByVal Length As Long)
' a mettre dans "form"
Private Sub Command1_Click()
Dim inputevents(0 To 3) As INPUT_TYPE ' holds information about each event
Dim keyevent As KEYBDINPUT ' temporarily hold keyboard input info
With keyevent
.wVk = vbKeyNumlock
.wScan = 0 ' not needed
.dwFlags = 0 ' press the key down
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
' Copy the structure into the input array's buffer.
inputevents(0).dwType = INPUT_KEYBOARD
CopyMemory inputevents(0).xi(0), keyevent, Len(keyevent)
With keyevent
.wVk = vbKeyNumlock
.wScan = 0 ' not needed
.dwFlags = KEYEVENTF_KEYUP ' release the key
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
inputevents(1).dwType = INPUT_KEYBOARD
CopyMemory inputevents(1).xi(0), keyevent, Len(keyevent)
SendInput 2, inputevents(0), Len(inputevents(0))
End Sub
cs_AlexMAN
Messages postés1536Date d'inscriptionsamedi 21 décembre 2002StatutMembreDernière intervention24 mai 20091 28 mars 2003 à 22:37
Fonctionne pas sous XP non plus !! Dommage ca pouvait etre interessant !! Frans, si tu avais l'équivalent des APIs que tu utilises sur XP, ce serait sympa !! Merci d'avance
cs_AlexMAN
Messages postés1536Date d'inscriptionsamedi 21 décembre 2002StatutMembreDernière intervention24 mai 20091 28 mars 2003 à 22:37
Fonctionne pas sous XP non plus !! Dommage ca pouvait etre interessant !! Frans, si tu avais l'équivalent des APIs que tu utilises sur XP, ce serait sympa !! Merci d'avance
cs_Frans
Messages postés38Date d'inscriptionvendredi 22 février 2002StatutMembreDernière intervention19 novembre 2003 20 août 2002 à 20:19
-> Skywalker13 - Tu as raison, ce programme utilise les fonctions API de Windows et a été développé sur 98. Je viens de le tester sur NT et effectivement ca ne marche pas.
Je compte passer en 2000 (ben oui, il est temps) et au besoin, j'essayerai de l'adapter pour qu'il tienne compte du systeme d'exploitation.
Skywalker13
Messages postés111Date d'inscriptiondimanche 6 janvier 2002StatutMembreDernière intervention27 août 2004 23 févr. 2002 à 09:42
14 juil. 2004 à 03:48
14 juil. 2004 à 03:48
1 déc. 2003 à 12:00
si ça marche merci bcp!!!!!
*bonne prog
8 nov. 2003 à 09:35
cet exemple permet juste d'allumer/eteindre le bouton numlock, mais l'adapter sera facile.
' a mettre dans un module !!!
' et creer un bouton command
Public Type KEYBDINPUT
wVk As Integer
wScan As Integer
dwFlags As Long
time As Long
dwExtraInfo As Long
End Type
Public Const KEYEVENTF_KEYUP = &H2
Public Type INPUT_TYPE
dwType As Long
xi(0 To 23) As Byte
End Type
Public Const INPUT_KEYBOARD = 1
Public Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As INPUT_TYPE, _
ByVal cbSize As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source _
As Any, ByVal Length As Long)
' a mettre dans "form"
Private Sub Command1_Click()
Dim inputevents(0 To 3) As INPUT_TYPE ' holds information about each event
Dim keyevent As KEYBDINPUT ' temporarily hold keyboard input info
With keyevent
.wVk = vbKeyNumlock
.wScan = 0 ' not needed
.dwFlags = 0 ' press the key down
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
' Copy the structure into the input array's buffer.
inputevents(0).dwType = INPUT_KEYBOARD
CopyMemory inputevents(0).xi(0), keyevent, Len(keyevent)
With keyevent
.wVk = vbKeyNumlock
.wScan = 0 ' not needed
.dwFlags = KEYEVENTF_KEYUP ' release the key
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
inputevents(1).dwType = INPUT_KEYBOARD
CopyMemory inputevents(1).xi(0), keyevent, Len(keyevent)
SendInput 2, inputevents(0), Len(inputevents(0))
End Sub
28 mars 2003 à 22:37
28 mars 2003 à 22:37
20 août 2002 à 20:19
Je compte passer en 2000 (ben oui, il est temps) et au besoin, j'essayerai de l'adapter pour qu'il tienne compte du systeme d'exploitation.
23 févr. 2002 à 09:42