c'est un petit programme qui fait un jeu de lumière des led du clavier
Source / Exemple :
Private Declare Function GetKeyState Lib _
"user32" (ByVal nVirtKey As Long) As Integer
Dim WshShell As Object
Dim i As Long
Public Function CapsLockOn() As Boolean
Dim iKeyState As Integer
iKeyState = GetKeyState(vbKeyCapital)
CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
End Function
Public Function NUMLockOn() As Boolean
Dim iKeyState As Integer
iKeyState = GetKeyState(vbKeyNumlock)
NUMLockOn = (iKeyState = 1 Or iKeyState = -127)
End Function
Public Function scrolllockOn() As Boolean
Dim iKeyState As Integer
iKeyState = GetKeyState(vbKeyScrollLock)
scrolllockOn = (iKeyState = 1 Or iKeyState = -127)
End Function
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command4_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
i = 0
If NUMLockOn = True Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
End If
If CapsLockOn = True Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{CAPSLOCK}"
End If
If scrolllockOn = True Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{SCROLLLOCK}"
End If
End Sub
Private Sub Timer1_Timer()
If i Mod 6 = 0 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
End If
If i Mod 6 = 1 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
End If
If i Mod 6 = 2 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{CAPSLOCK}"
End If
If i Mod 6 = 3 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{CAPSLOCK}"
End If
If i Mod 6 = 4 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{SCROLLLOCK}"
End If
If i Mod 6 = 5 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{SCROLLLOCK}"
End If
i = i + 1
End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.