Est ce que quelqu'un peut me dire comment faire une interface du style Explorateur Windows avec GUICtrlCreateTreeView.
Je cherche à créer une application qui me permette de copier de dossiers sur plusieurs Serveurs.
Et j'aimerai dans mon interface que l'utilisateur puisse sélectionner le dossier qu'il veut copier.
Il me faudrait la même arborescence que l'explorateur.
Voici mon code:
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#Include <String.au3>
#include <File.au3>
#include <Array.au3>
#include <FileListToArray3.au3>
#include <Date.au3>
#Region ### START Koda GUI section ### Form=D:\auto_IT\file_update\copie_folder.kxf
$Form1 = GUICreate("Form1", 813, 653, 1476, 111)
$TreeView1 = GUICtrlCreateTreeView(24, 208, 281, 393, BitOr ($TVS_CHECKBOXES , $TVS_HASBUTTONS , $TVS_HASLINES , $TVS_LINESATROOT, $TVS_SINGLEEXPAND))
$Label1 = GUICtrlCreateLabel("Sélectionnez un dossier à copier vers les différents Serveurs", 16, 168, 287, 17)
$ListAllServer = GUICtrlCreateList("", 328, 208, 137, 396,BitOR($LBS_SORT,$WS_BORDER))
$ListAllServerSelected = GUICtrlCreateList("", 520, 208, 137, 396,BitOR($LBS_SORT,$WS_BORDER))
$Label2 = GUICtrlCreateLabel("Label2", 328, 168, 36, 17)
$Label3 = GUICtrlCreateLabel("Label3", 520, 168, 36, 17)
$BStop = GUICtrlCreateButton("FERMER", 696, 560, 81, 33, $WS_GROUP)
$BSelect = GUICtrlCreateButton(">", 480, 345, 25, 23, $WS_GROUP)
;$BUnSelect = GUICtrlCreateButton("<", 480, 392, 25, 25, $WS_GROUP)
;$BSelectAll = GUICtrlCreateButton(">>", 480, 296, 25, 25, $WS_GROUP)
$BUnSelectAll = GUICtrlCreateButton("<<", 480, 392, 25, 25, $WS_GROUP)
$BStart = GUICtrlCreateButton("DEMARRER", 696, 336, 81, 41, $WS_GROUP)
$Input1 = GUICtrlCreateInput("", 184, 88, 249, 21)
$Label4 = GUICtrlCreateLabel("Chemin de recherche", 8, 88, 155, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("", 0, 120, 785, 9)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$BSearch = GUICtrlCreateButton("Rechercher", 440, 88, 73, 25, $WS_GROUP)
$Label5 = GUICtrlCreateLabel("Copie automatique de Dossiers et fichiers ", 24, 8, 546, 36)
GUICtrlSetFont(-1, 20, 400, 0, "ITC Avant Garde Gothic")
$Pic1 = GUICtrlCreatePic("D:\auto_IT\file_update\logoCPAM81.jpg", 592, 0, 217, 113, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GLOBAL $deb_chemin = "\\" ; Début du chemin vers partage du serveur
GLOBAL $config_file = "config_copy2.ini" ; Fichier de paramétrage de l'application
GLOBAL $path_log ; Création d'un fichier LOG temporaire / Penser à le supprimer à la fin de l'exécution du l'application
GLOBAL $default_path ; Création d'un fichier LOG temporaire / Penser à le supprimer à la fin de l'exécution du l'application
GLOBAL $OS_version = @OSVersion
GLOBAL $order_sequence = 0
;
;
; RECUPERATION DES INFORMATION CONTENU DANS LE FICHIER DE PARAMETRAGE
;
;
$default_path = IniRead($config_file,"PATH","path","NotFound")
If @error Then
MsgBox(4096, "LOG", "Error occurred, probably no INI file.")
Else
GUICtrlSetData($Input1,$default_path)
EndIf
$path_log = IniRead($config_file,"LOG","log","NotFound")
If @error Then
MsgBox(4096, "LOG", "Error occurred, probably no INI file.")
EndIf
$var_liste = IniReadSection($config_file,"LISTE")
If @error Then
MsgBox(4096, "LISTE", "Error occurred, probably no INI file.")
EndIf
Dim $liste_serveur[UBound($var_liste)-1] ; Liste des serveurs CPAM
Dim $liste_etat_serveur[UBound($var_liste)-1] ; Liste des état des serveurs CPAM
Dim $liste_ip_serveur[UBound($var_liste)-1] ; Liste des IP des serveurs CPAM
Dim $text[UBound($var_liste)-1]
$j=0
For $i = 1 To $var_liste[0][0]
$array_serveur = StringSplit($var_liste[$i][1],"|",1)
If @error Then
MsgBox(4096, "StringSplit Error", "Error occurred, probably no data in $var_liste.")
EndIf
$liste_serveur[$j] = $array_serveur[1]
$liste_ip_serveur[$j] = $array_serveur[2]
GUICtrlSetData($ListAllServer,$liste_serveur[$j])
$j = $j +1
Next
;$line = _ArrayToString($text,@CRLF,0,UBound($liste_ip_serveur) -1)
;GUICtrlSetData($ListAllServer,$line)
;If @error Then
; MsgBox(4096, "GUICtrlSetData Error", "Error occurred for 'GUICtrlSetData' function.")
;Else
; $order_sequence =1
;EndIf
;For $i = 1 To $var_type[0][0]
; $ar_Array = _FileListToArray3 ($deb_chemin&$serveur&$work_folder, "*."&$var_type[$i][1], 1, 1, 1,"Temp|TMP")
; $ar_Array = _FileListToArrayRecAll1($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "")
; $size_ar_Array = $size_ar_Array + UBound($ar_Array)-1
;Next
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
Case $msg = $BSearch
Case $msg = $BStart
Case $msg = $BSelect
$vSelect = GUICtrlRead($ListAllServer,$GUI_CHECKED)
GUICtrlSetData($ListAllServerSelected,$vSelect)
Case $msg = $BUnSelectAll
$vUnSelect = GUICtrlRead($ListAllServerSelected,$GUI_CHECKED)
GUICtrlSetData($ListAllServerSelected,"")
Case $msg = $BStop
Exit
EndSelect
WEnd
Mon idée d'utiliser GUICtrlCreateTreeView est elle appropriée ?
Merci pour vos réponses
A+