J'ai déjà fait quelques scripts mais dans celui là je ne comprends pas pourquoi lorsque j'appuie sur mes boutons il ne se passe rien T_T !
J'ai beau regarder l'aide ou d'autre ancien script j'arrive à comprendre >< !
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
Global $stats[6]
Global $test_pc
Global $grp_hardware
Global $lbl_cpu,$lbl_RAM,$lbl_HDD,$lbl_GC
Global $btn_update_hardware,$btn_dxdiag,$btn_devmgmt
main()
Func GUI_Create()
;GUI ****************************************
$test_pc = GUICreate("PC", 300, 250, 200, 100)
;Group ****************************************
$grp_hardware = GUICtrlCreateGroup("Votre pc : ", 20, 20, 250,200)
;label ***************************************
$lbl_cpu = GUICtrlCreateLabel("CPU : mise à jour ....", 30,40, 200, 20)
$lbl_RAM = GUICtrlCreateLabel("RAM : mise à jour ....", 30,60, 200, 20)
$lbl_HDD = GUICtrlCreateLabel("HDD : mise à jour ....", 30,80, 200, 20)
$lbl_GC = GUICtrlCreateLabel("Carte graphique : mise à jour ....", 30,100, 220, 20)
;Bouton ******************************************************************************
$btn_update_hardware = GUICtrlCreateButton("Mise à jour", 30, 120,60,30,0)
GUISetOnEvent(-1, "Init_hardware")
$btn_dxdiag = GUICtrlCreateButton("dxdiag", 100, 120,60,30,0)
GUISetOnEvent(-1, "dxdiag")
$btn_devmgmt = GUICtrlCreateButton("Périphériques", 170, 120,80,30,0)
GUISetOnEvent(-1, "devmgmt")
Opt("GUIOnEventMode", 1) ;Permet d'utiliser les évènement GUICtrlSetOnEvent
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState(@SW_SHOW) ; Affiche la GUI
EndFunc
Func Init_hardware()
GUICtrlSetData($lbl_cpu,"CPU : " & search_cpu() )
update_memory()
search_HDD()
GUICtrlSetData($lbl_GC,"Carte graphique : " & RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winsat","PrimaryAdapterString" ))
EndFunc
Func update_memory()
$stats=MemGetStats()
GUICtrlSetData($lbl_RAM,"RAM : " & ((($stats[1]/100)-mod(($stats[1]/100),1))/10) - (($stats[2]/100)-mod(($stats[2]/100),1))/10 & "/" & (($stats[1]/100)-mod(($stats[1]/100),1))/10 & " Mo occupé" )
EndFunc
Func search_HDD()
local $reg_path = "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi"
Global $HDD_label_location = 60
For $scsi_port = 0 to 6
$reg_path = $reg_path & "\Scsi Port "& $scsi_port
For $scsi_bus = 0 to 10
$reg_path = $reg_path & "\Scsi Bus "& $scsi_bus
For $target_id = 0 to 10
$reg_path = $reg_path & "\Target Id "& $target_id
For $logical_unit = 0 to 10
$reg_path = $reg_path & "\Logical unit Id "& $logical_unit
if RegRead($reg_path,"Identifier") <> "" Then
$HDD_label_location += 20
$lbl_HDD = GUICtrlCreateLabel("HDD : "& RegRead($reg_path,"Identifier"), 30,$HDD_label_location, 200, 20)
EndIf
Next
Next
Next
Next
EndFunc
Func search_cpu()
Return RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","ProcessorNameString")
EndFunc
Func Close()
Exit
EndFunc
Func dxdiag()
MsgBox(0,"","Hola dxdiag !")
ShellExecuteWait("dxdiag")
EndFunc
Func devmgmt()
MsgBox(0,"","Hola devmgmt !")
ShellExecuteWait("devmgmt.msc")
EndFunc
Func main()
GUI_Create()
Init_hardware()
while true
Sleep(3000)
update_memory()
WEnd
EndFunc
Edit : Et ce que je comprend encore moins c'est que le bouton pour fermer la fenetre ($GUI_EVENT_CLOSE) fonctionne très bien...



