j'ai créé un code pour une double authentification. La fenêtre de génération du code est longue à se fermer (environ 15 secondes).
Je ne vois pas où je pèche....
Quelqu'un aurait il une idée?
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $hGUI, $hLabel, $hCode, $hButtonQuit
$hGUI = GUICreate("Code", 300, 140)
$hLabel = GUICtrlCreateLabel("", 10, 10, 280, 40, $SS_CENTER)
$hCode = GUICtrlCreateLabel("", 10, 60, 280, 40, $SS_CENTER)
$hButtonQuit = GUICtrlCreateButton("Quitter", 100, 100, 100, 30)
GUISetState(@SW_SHOW)
While 1
Local $msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE, $hButtonQuit
ExitLoop
EndSwitch
Local $currentTime = @HOUR & ":" & @MIN & ":" & @SEC
Local $nextMinute = @HOUR & ":" & @MIN + 1 & ":00"
Local $timeDiff = _TimeDiff($currentTime, $nextMinute)
GUICtrlSetData($hLabel, "Code valable pendant " & $timeDiff & " secondes")
$code = Number(@YDAY) * Number(@MDAY) * Number(@HOUR) * Number(@MIN)
GUICtrlSetData($hCode, "Code déverrouillage " & $code)
Sleep(1000)
WEnd
Func _TimeDiff($currentTime, $nextMinute)
Local $currentTimeArray = StringSplit($currentTime, ":")
Local $nextMinuteArray = StringSplit($nextMinute, ":")
Local $currentSeconds = $currentTimeArray[1] * 3600 + $currentTimeArray[2] * 60 + $currentTimeArray[3]
Local $nextMinuteSeconds = $nextMinuteArray[1] * 3600 + $nextMinuteArray[2] * 60 + $nextMinuteArray[3]
Local $diff = $nextMinuteSeconds - $currentSeconds
Return $diff
EndFunc
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $hGUI, $hLabel, $hCode, $hButtonQuit
$hGUI = GUICreate("Code", 300, 140)
$hLabel = GUICtrlCreateLabel("", 10, 10, 280, 40, $SS_CENTER)
$hCode = GUICtrlCreateLabel("", 10, 60, 280, 40, $SS_CENTER)
$hButtonQuit = GUICtrlCreateButton("Quitter", 100, 100, 100, 30)
GUISetState(@SW_SHOW)
While 1
Local $msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE, $hButtonQuit
ExitLoop
EndSwitch
Local $currentTime = @HOUR & ":" & @MIN & ":" & @SEC
Local $nextMinute = @HOUR & ":" & @MIN + 1 & ":00"
Local $timeDiff = _TimeDiff($currentTime, $nextMinute)
GUICtrlSetData($hLabel, "Code valable pendant " & $timeDiff & " secondes")
$code = Number(@YDAY) * Number(@MDAY) * Number(@HOUR) * Number(@MIN)
GUICtrlSetData($hCode, "Code déverrouillage " & $code)
Sleep(1000)
WEnd
Func _TimeDiff($currentTime, $nextMinute)
Local $currentTimeArray = StringSplit($currentTime, ":")
Local $nextMinuteArray = StringSplit($nextMinute, ":")
Local $currentSeconds = $currentTimeArray[1] * 3600 + $currentTimeArray[2] * 60 + $currentTimeArray[3]
Local $nextMinuteSeconds = $nextMinuteArray[1] * 3600 + $nextMinuteArray[2] * 60 + $nextMinuteArray[3]
Local $diff = $nextMinuteSeconds - $currentSeconds
Return $diff
EndFunc