- Offizieller Beitrag
Hallo!
So ich hab mal wider ein Skript für euch: Es zeigt kompfortabel an wann Das System gestartet wurde! Aslo wieviel zeit bis dahin Verstrichen ist
Spoiler anzeigen
C
TraySetState(2)
#include <misc.au3>
#include <GUIConstants.au3>
#Include <Constants.au3>
Opt("TrayMenuMode",1)
$togui = TrayCreateItem("Zu Gui")
$akttray = TrayCreateItem("Aktualiesieren")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
GUICreate("System UpTime - By GtaSpider", 198, 79, 211, 117)
$akt = GUICtrlCreateButton("&Aktualiesieren", 10, 50, 85, 25, 0)
$totray = GUICtrlCreateButton("Zu &Tray", 105, 50, 85, 25, 0)
$time = GUICtrlCreateInput("Error!", 10, 10, 181, 20)
$timelab = GUICtrlCreateLabel("Error!", 10, 30, 179, 17)
_GetSysUpTime($time,$timelab)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $akt
_GetSysUpTime($time,$timelab)
Case $totray
_TrayWhile()
EndSwitch
WEnd
Func _TrayWhile()
TraySetState()
;~ TraySetState(16)
GUISetState(@SW_HIDE)
While 1
$msg = TrayGetMsg()
Switch $msg
Case $exit
Exit
Case $togui
ExitLoop
Case $akttray
_GetSysUpTime($time,$timelab,1345)
EndSwitch
WEnd
TraySetState(2)
GUISetState()
EndFunc
Func _GetSysUpTime($Gui_Time,$Gui_Time_Lab,$Tray=0)
$ret = DllCall("kernel32.dll", "long", "GetTickCount")
Global $day = 0, $type = "Days", $hour = 0, $min = 0, $sec = 0, $msec = 0, $mtype = "", $stype = "", $mitype = "", $htype = ""
$msec = StringRight("00" & Mod($ret[0], 1000), 3)
_Iif($msec > 1, $mtype = "s", $mtype = "")
$mtype = "Milisecond" & $mtype
$uptime = Floor($ret[0] / 1000)
$sec = StringRight("00" & Mod($uptime, 60), 2)
_Iif($sec > 1, $stype = "s", $stype = "")
$stype = "Second" & $stype
If $uptime >= 60 Then
$uptime = Floor($uptime / 60)
$min = StringRight("00" & Mod($uptime, 60), 2)
_Iif($min > 1, $mitype = "s", $mitype = "")
$mitype = "Minute" & $mitype
$uptime = Floor($uptime / 60)
$hour = StringRight("00" & Mod($uptime, 24), 2)
_Iif($hour > 1, $htype = "s", $htype = "")
$htype = "Hour" & $htype
If $uptime >= 24 Then; convert hours to days
$day = Floor($uptime / 24)
$type = ""
If $day > 1 Then $type = "s"
$type = " Day" & $type & " "
EndIf
EndIf
GUICtrlSetData($Gui_Time,$day & " - " & $hour & ":" & $min & ":" & $sec & "." & $msec)
GUICtrlSetData($Gui_Time_Lab,$type & "-" & $htype & ":" & $mitype & ":" & $stype & "." & $mtype)
If $Tray <> 0 Then
TrayTip("System Startzeit",$day & " - " & $hour & ":" & $min & ":" & $sec & "." & $msec,3)
EndIf
EndFunc
Alles anzeigen
Mfg Spider