'usf password
'patricktoulon
#If VBA7 Then
Private Declare PtrSafe Function GetKeyState Lib "user32.dll" (ByVal KeyCode As Long) As Integer
#Else
Private Declare Function GetKeyState Lib "user32.dll" (ByVal KeyCode As Long) As Integer
#End If
Option Explicit
Private Sub CheckMAJ_Change()
Touch_ColorCheck CheckMAJ.Value, CheckNUM.Value
End Sub
Private Sub CheckNUM_Change()
Touch_ColorCheck CheckMAJ.Value, CheckNUM.Value
End Sub
Private Sub UserForm_Activate()
CheckMAJ.Value = (&H1 And GetKeyState(vbKeyCapital)) <> 0
CheckNUM.Value = (&H1 And GetKeyState(&H90)) <> 0
End Sub
Sub Touch_ColorCheck(ch1, ch2)
Dim Wsh As Object
If ActiveControl.Name = "CheckMAJ" Or ActiveControl.Name = "CheckNUM" Then
Set Wsh = CreateObject("Wscript.shell")
Select Case ActiveControl.Name
Case "CheckMAJ"
Wsh.SendKeys ("{CAPSLOCK}")
Case "CheckNUM"
Wsh.SendKeys ("{NUMLOCK}")
End Select
Set Wsh = Nothing
End If
CheckMAJ.Caption = Array("MAJUSCULE DEACTIVÉE !!", "MAJUSCULE ACTIVÉE !!")(Abs(CheckMAJ.Value))
CheckMAJ.ForeColor = Array(vbYellow, vbRed)(Abs(CheckMAJ.Value))
CheckNUM.Caption = Array("PAVE NUMERIQUE DEACTIVÉ !!", "PAVE NUMERIQUE ACTIVÉ !!")(Abs(CheckNUM.Value))
CheckNUM.ForeColor = Array(vbYellow, vbRed)(Abs(CheckNUM.Value))
'
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) 'rend le bouton(croix inactif)
If CloseMode = 0 Then Cancel = True
End Sub
Private Sub QUITTER_Click()
'blabla faire ce que tu veux en fermant!!!
Unload Me
End Sub