Code : Tout sélectionner
#include <GUIConstantsEx.au3>
$tempo = 1000 * 60 ; Mets ici la frequence de rafraichissement en Ms
;Test existance RideRunner
$rr = "NIL"
$F = WinExists("RideRunner")
If $F = 0 Then MsgBox(0, "Error", "Ride Runner doit fonctionner pour que Speedlimit démarre", 5)
If $F = 1 Then
$rr = ObjCreate("RideRunner.SDK")
EndIf
;Informations issues de RideRunner
$MySpd = $rr.GetInfo("GPSSPD")
$CurrentLat = $rr.getinfo("GPSLAT")
$CurrentLon = $rr.getinfo("GPSLON")
$CurrentHDG = $rr.getinfo("GPSHDG")
;MsgBox(0, '', $CurrentLat )
#Region ### START Koda GUI section ###
$Form1 = GUICreate("RRGetInfo V1.0", 568, 353, -1, -1)
$label1 = GUICtrlCreateLabel("La vitesse est de :" & $rr.GetInfo("GPSSPD"), 16, 40, 400, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$label2 = GUICtrlCreateLabel("La Latitude de : " & $rr.getinfo("GPSLAT"), 16, 80, 400, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$label3 = GUICtrlCreateLabel("La Longitude est de : " & $rr.getinfo("GPSLON"), 16, 120, 400, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$label4 = GUICtrlCreateLabel("Le nombre de radars est de : " & $rr.getinfo("GPSLON"), 16, 160, 400, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Annuler = GUICtrlCreateButton("Annuler", 480, 296, 75, 25)
$MAJ = GUICtrlCreateButton("Get", 480, 296, 75, 25)
$OK = GUICtrlCreateButton("OK", 392, 296, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Sleep(10000)
AdlibEnable("GetRide", $tempo)
While 1 ; Boucle de message (voir la section création d'une GUI pour comprendre le fonctionnement)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Annuler ; Si la fenêtre est fermée ou si le bouton annulé est cliqué.
Exit
; on attribue ca valeur au champ de l'input.
Case $OK ; Si le bouton OK à été cliqué.
GUICtrlRead($label1) ; On lit la variable GPSSPD issue de RideRunner
GUIDelete($Form1) ; Efface la GUI
Case $MAJ
GetRide()
EndSwitch
WEnd
AdlibDisable()
Func GetRide()
If IsObj($rr) Then
$MySpd = $rr.GetInfo("GPSSPD")
$CurrentLat = $rr.getinfo("GPSLAT")
$CurrentLon = $rr.getinfo("GPSLON")
$CurrentHDG = $rr.getinfo("GPSHDG")
EndIf
EndFunc ;==>GetRide