#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$var = DriveSpaceFree("C:")
$hdd=Ceiling($var/1024)
$Form1_1 = GUICreate("Form1", 433, 278, -1,-1)
$Group1 = GUICtrlCreateGroup("常用软件", 8, 13, 193, 210)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 24, 40, 80, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 24, 96, 80, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox3", 24, 160, 80, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("系统资源", 216, 13, 209, 210)
$Label1 = GUICtrlCreateLabel("CPU 使用率:", 232, 48, 100, 17)
$Label2 = GUICtrlCreateLabel("内存使用率:", 232, 104, 100, 17)
$Label3 = GUICtrlCreateLabel("C 盘使用率(GB):", 232, 160, 100, 17)
$Label4 = GUICtrlCreateLabel($hdd, 330, 160, 100, 17)
$Label5 = GUICtrlCreateLabel("", 310, 48, 100, 17)
$Label6 = GUICtrlCreateLabel("", 310, 104, 100, 17)
$Progress1 = GUICtrlCreateProgress(232, 72, 185, 10)
$Progress2 = GUICtrlCreateProgress(232, 128, 185, 10)
$Progress3 = GUICtrlCreateProgress(232, 184, 185, 10)
GUICtrlSetData($Progress3,$hdd)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("安 装", 176, 232, 73, 33)
$Button2 = GUICtrlCreateButton("退 出", 264, 232, 73, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("CpuRamRate",500)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
Exit
EndSwitch
WEnd
Func CpuRamRate()
Local $rCPU,$rRAM
$rCPU=CurrentCPURate()
$rRAM=CurrentRAMRate()
GUICtrlSetData($Progress1,$rCPU)
GUICtrlSetData($Progress2,$rRAM)
GUICtrlSetData($Label5,$rCPU&"%")
GUICtrlSetData($Label6,$rRAM&"%")
EndFunc
Func CurrentCPURate()
$wbemServices = ObjGet("winmgmts:\\.\root\cimv2")
$wbemObjectSet= $wbemServices.ExecQuery("Select * from Win32_Processor")
For $wbemObject In $wbemObjectSet
$dd=$wbemObject.LoadPercentage
Next
Return $dd
EndFunc
Func CurrentRAMRate()
Local $Array[7]
$Array=MemGetStats()
Return $Array[0]
EndFunc