[EX] Info Disque

Partagez vos scripts, et vos applications AutoIt.
Règles du forum
.
Répondre
Avatar du membre
GELDROC
Niveau 6
Niveau 6
Messages : 295
Enregistré le : sam. 10 oct. 2009 10:15
Status : Hors ligne

[EX] Info Disque

#1

Message par GELDROC »

Salut voila le début de mon programme d'information et de gestion disque


--Mise a jour du fichier drive_info.au3 le 12/12/2009

--ajout de la fonction :
-Partager
-Formater(modifier)

-- conversion des information en Gigaoctet au lieu de octet

--ressource importer vers un dll
 fichier joint:
 -graphic.dll

Code : Tout sélectionner

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <WinAPI.au3>
#include <FontConstants.au3>
#include <GDIPlus.au3>
#include <StructureConstants.au3>
#include <Sound.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#Include <File.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>
#include <string.au3>
#include <NetShare.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GUIConstants.au3>


Opt("GUICoordMode", 1)  

_1()
func _1()
local $WIN_Width = @DesktopWidth
local $WIN_Height = @DesktopHeight
local $GUI_Width = 400
local $GUI_Height = 240
local $GUI_Top = 60
local $GUI_Left = $WIN_Width - $GUI_Width -2
Global $GLIS_X = 1
Local $Drive = DriveGetDrive( "all" )
Local $Drivew
local $GUI = GUICreate("GUI", $GUI_Width, $GUI_Height, $GUI_Left, $GUI_Top, $WS_POPUP)
GUISetBkColor(0x424242)
Local $rgn = _WinAPI_CreateRoundRectRgn(10, 10, $GUI_Width , $GUI_Height, 5,5)                          
_WinAPI_SetWindowRgn($GUI, $rgn)
Global $EXIT = GUICtrlCreatePic("", 356, 14, 21, 21)
Global $GILSS = GUICtrlCreatePic("", 384, 14, 11, 220)
Global $OPT = GUICtrlCreatePic("", 270, 14, 28, 24)
AdlibEnable("_On_Over", 50)
Local $OptionsDummy = GUICtrlCreateDummy()
Local $OptionsContext = GUICtrlCreateContextMenu($OptionsDummy)
Local $Options1 = GUICtrlCreateMenuItem("Modifer le nom de volume", $OptionsContext)
Local $Options2 = GUICtrlCreateMenuItem("Formater", $OptionsContext)
Local $Options3 = GUICtrlCreateMenuItem("Netoyer", $OptionsContext)
Local $Options4 = GUICtrlCreateMenuItem("Defragmmenter", $OptionsContext)
Local $Options5 = GUICtrlCreateMenuItem("Partager", $OptionsContext)
Global $SelctDrive = GUICtrlCreateCombo($Drive[1]&"   "&DriveGetLabel($Drive[1]), 14, 14, 250, 10)
for $Y = 2 to $Drive[0]
GUICtrlSetData(-1, $Drive[$Y]&"   "&DriveGetLabel($Drive[$Y]))
Next
GUICtrlSetBkColor(-1, 0x0080C0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUISetState()
GUICtrlCreateLabel("Nom du volume ", 14, 45, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL0 = GUICtrlCreateLabel("test", 164, 45, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUICtrlCreateLabel("System de fichier ", 14, 65, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL1 = GUICtrlCreateLabel("test", 164, 65, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUICtrlCreateLabel("Numéro de serie ", 14, 85, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL2 = GUICtrlCreateLabel("test", 164, 85, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUICtrlCreateLabel("Espace TOTAL ", 14, 115, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL3 = GUICtrlCreateLabel("test", 164, 115, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUICtrlCreateLabel("Espace UTILISER ", 14, 135, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL4 = GUICtrlCreateLabel("test", 164, 135, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
GUICtrlCreateLabel("Espace LIBRE ", 14, 155, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL5 = GUICtrlCreateLabel("test", 164, 155, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $LABEL6 = GUICtrlCreateLabel("", 14, 185, 150, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 200, 0, "Tahoma")
Global $Pbar = GUICtrlCreateProgress(14, 212, 360, 20)
GUISetState()
_Set_Drive_Info()
While 1
Global $msg = GUIGetMsg()   
Switch $msg
case $EXIT
Exit
Case $SelctDrive
_Set_Drive_Info()   
Case $GILSS
GUIDelete($GUI)
_0()
Case $OPT
ShowMenu($GUI, $msg, $OptionsContext)
case $Options1
GUIDelete($GUI)
_label()
Case $Options2
$Drivew = Asc(StringUpper(GUICtrlRead($SelctDrive))) - 65
If $Drivew >= 0 Then
Local  $Capacite = 0 ; 0 = Capacité par défaut
Local $FormatType = 1 ; 0 = formatage complet, 1 = formatage rapide
DllCall("SHELL32.DLL", "int", "SHFormatDrive", "hwnd", $GUI, "uint", $Drivew, "uint", $Capacite, "uint", $FormatType)
EndIf
Case $Options3
GUIDelete($GUI)
RunWait(@HomeDrive&"\WINDOWS\SYSTEM32\cleanmgr.exe")
Return _1()
Case $Options4
GUIDelete($GUI)
RunWait("mmc.exe %SYSTEMDRIVE%\WINDOWS\SYSTEM32\dfrg.msc")
Return _1()
Case $Options5
_Net_Share_ShareAdd (@ComputerName, DriveGetLabel(StringLeft(GUICtrlRead($SelctDrive), 2)), $STYPE_DISKTREE, StringLeft(GUICtrlRead($SelctDrive), 2)&"\", DriveGetLabel(StringLeft(GUICtrlRead($SelctDrive), 2)))
If @error Then MsgBox (4096, "Information", "Share add error : " & @error)
EndSwitch
WEnd
EndFunc

_0()
func _0()
local $WIN_Width = @DesktopWidth
local $WIN_Height = @DesktopHeight
local $GUI_Width = 30
local $GUI_Height = 240
local $GUI_Top = 60
local $GUI_Left = $WIN_Width - $GUI_Width -2
Global $GLIS_X = 0
local $GUI = GUICreate("GUI", $GUI_Width, $GUI_Height, $GUI_Left, $GUI_Top, $WS_POPUP)
GUISetBkColor(0x424242)
Local $rgn = _WinAPI_CreateRoundRectRgn(10, 10, $GUI_Width , $GUI_Height, 5,5)                          
_WinAPI_SetWindowRgn($GUI, $rgn)    
Global $GILSS = GUICtrlCreatePic("", 14, 14, 11, 220)
GUISetState()
AdlibEnable("_On_OverBis", 50)
While 1
Switch GUIGetMsg()
Case $GILSS
GUIDelete($GUI)
_1()
EndSwitch
WEnd
EndFunc

Func _Set_Drive_Info()
Local $TOTAL = DriveSpaceTotal(StringLeft(GUICtrlRead($SelctDrive), 2))
Local $FREE = DriveSpaceFree(StringLeft(GUICtrlRead($SelctDrive), 2))
Local $UTILISER = $TOTAL-$FREE
Local $PX = $TOTAL/100
Local $P_U = $UTILISER/$PX
Local $0_App_V = stringsplit($P_U, ".", 1)
GUICtrlSetData($Pbar, $0_App_V [1])
GUICtrlSetData($LABEL0, ": "&DriveGetLabel(StringLeft(GUICtrlRead($SelctDrive), 2)))
GUICtrlSetData($LABEL1, ": "&DriveGetFileSystem(StringLeft(GUICtrlRead($SelctDrive), 2)))
GUICtrlSetData($LABEL2, ": "&DriveGetSerial(StringLeft(GUICtrlRead($SelctDrive), 2)))
Local $TOTALGB = StringSplit($TOTAL/1000, ".", 2)
Local $UTILISERGB = StringSplit($UTILISER/1000, ".", 2)
Local $FREEGB = StringSplit($FREE/1000, ".", 2)
GUICtrlSetData($LABEL3, ": "&$TOTALGB[0]&"  GB")
GUICtrlSetData($LABEL4, ": "&$UTILISERGB[0]&"  GB")
GUICtrlSetData($LABEL5, ": "&$FREEGB[0]&"  GB")
GUICtrlSetData($LABEL6, $0_App_V [1]&"% D'espace utiliser")
GUISetState()
EndFunc

Func _label()
Local $Drive = DriveGetDrive( "all" )
Local $labelG = GUICreate("Modifier le nom du lecteur", 200, 150, -1, -1)
GUICtrlCreateLabel("Selectioner un lecteur :", 25, 10, 200, 20)
Global $SECLT_DRIVE = GUICtrlCreateCombo($Drive[1], 25, 30, 150, 10)
for $Y = 2 to $Drive[0]
GUICtrlSetData(-1, $Drive[$Y])
Next
GUICtrlCreateLabel("Nom du volume :", 25, 70, 200, 20)
Global $LABEL = GUICtrlCreateInput("VOLUME", 25, 90, 150, 20)
Global $MODOFIER = GUICtrlCreateButton("Modifier", 50, 120, 100, 25)
GUISetState()
While 1
Global $msg = GUIGetMsg()   
Switch $msg
case $GUI_EVENT_CLOSE
GUIDelete($labelG)
_1()
Case $MODOFIER
DriveSetLabel(GUICtrlRead($SECLT_DRIVE), GUICtrlRead($LABEL))
GUIDelete($labelG)
GUISetState()
_1()
EndSwitch
WEnd
EndFunc

Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)
    $arPos = ControlGetPos($hWnd, "", $CtrlID)
    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]
    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
EndFunc   

Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")
    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)
    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))
    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    $stPoint = 0
EndFunc

Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc 

Func _GUICtrlCreatePicDLL_Set_On_Over($pic_down, $pic_over, $OBT)
Local  $hLib, $hBmp
Local $mousepos = GUIGetCursorInfo()
If @error Then
Else
Select 
Case $mousepos[4] = $OBT And $mousepos[2] = 1
    $hLib = _WinAPI_LoadLibrary("graphic.dll")
    $hBmp = _WinAPI_LoadImage($hLib, $pic_down, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR)
    GUICtrlSendMsg($OBT, 0x0172, $IMAGE_BITMAP, $hBmp)
Case $mousepos[4] = $OBT And $mousepos[2] = 0
   $hLib = _WinAPI_LoadLibrary("graphic.dll")
    $hBmp = _WinAPI_LoadImage($hLib, $pic_over, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR)
    GUICtrlSendMsg($OBT, 0x0172, $IMAGE_BITMAP, $hBmp)
Case $mousepos[4] <> $OBT
    $hLib = _WinAPI_LoadLibrary("graphic.dll")
    $hBmp = _WinAPI_LoadImage($hLib, $pic_down, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR)
    GUICtrlSendMsg($OBT, 0x0172, $IMAGE_BITMAP, $hBmp)
EndSelect
EndIf
GUISetState()
EndFunc

Func _On_Over()
_GUICtrlCreatePicDLL_Set_On_Over("EXIT", "EXITOVER", $EXIT)
_GUICtrlCreatePicDLL_Set_On_Over($GLIS_X&"GLISS", $GLIS_X&"GLISSOVER", $GILSS)
_GUICtrlCreatePicDLL_Set_On_Over("OPTION", "OPTIONOVER", $OPT)
EndFunc

Func _On_OverBis()
_GUICtrlCreatePicDLL_Set_On_Over($GLIS_X&"GLISS", $GLIS_X&"GLISSOVER", $GILSS)
EndFunc


 

...
Fichiers joints
graphic.rar
ressource : le 12/12/2009
(4.19 Kio) Téléchargé 296 fois
Modifié en dernier par GELDROC le sam. 12 déc. 2009 20:21, modifié 3 fois.
Avatar du membre
timmalos
Niveau 11
Niveau 11
Messages : 1970
Enregistré le : dim. 18 mai 2008 15:16
Status : Hors ligne

Re: [EX] Info Disque

#2

Message par timmalos »

peut etre que mon SysInfo peut t'aider a ameliorer ton soft niveau quantité d'informations:
http://www.autoitscript.fr/forum/viewto ... f=6&t=1992
Avatar du membre
GELDROC
Niveau 6
Niveau 6
Messages : 295
Enregistré le : sam. 10 oct. 2009 10:15
Status : Hors ligne

Re: [EX] Info Disque

#3

Message par GELDROC »

merci beaucoup bon aller je me mes au Bouleau :)
Avatar du membre
GELDROC
Niveau 6
Niveau 6
Messages : 295
Enregistré le : sam. 10 oct. 2009 10:15
Status : Hors ligne

Re: [EX] Info Disque

#4

Message par GELDROC »

desoler message a suprimer
Modifié en dernier par GELDROC le jeu. 03 déc. 2009 11:24, modifié 1 fois.
Avatar du membre
Tlem
Site Admin
Site Admin
Messages : 11796
Enregistré le : ven. 20 juil. 2007 21:00
Localisation : Bordeaux
Status : Hors ligne

Re: [EX] Info Disque

#5

Message par Tlem »

C'est sur le premier message que vous devez apporter les modifications ou ajout de fichiers.
Thierry

Rechercher sur le forum ----- Les règles du forum
Le "ça ne marche pas" est une conséquence commune découlant de beaucoup trop de raisons potentielles ...

Une idée ne peut pas appartenir à quelqu'un. (Albert Jacquard) tiré du documentaire "Copié n'est pas volé".
Avatar du membre
GELDROC
Niveau 6
Niveau 6
Messages : 295
Enregistré le : sam. 10 oct. 2009 10:15
Status : Hors ligne

Re: [EX] Info Disque

#6

Message par GELDROC »

Mise a jour du programme le: 12/12/2009 :

--ajout de la fonction :
-Partager
-Formater(modifier)

-- conversion des information en Gigaoctet au lieu de octet

--ressource importer vers un dll
fichier joint:
-graphic.dll
Répondre