je ramène un code qui refuse de fonctionner correctement.
Le 1er problème se trouve dans la procedure Ouvrir_Zip(filename.s)(impossible d'afficher correctement les fichiers) par contre quand je décommente le SetGadgetText(#ExplorerList_Principale,String) cela m'affiche simplement un seul fichier
Le 2nd probleme concerne la lib pureZip de Gnozal(quelq'un peut confirmer ?)
utiliser la fenetre de progression ne marche pas en mode fenetré mais fonction bien en mode console
Code : Tout sélectionner
;Auteur: SpaceMan 
;version: Démo 
;User Lib: pureZip (gnozal)
;{- Enumerations 
;{ Windows 
Enumeration 
  #Window_0 
  #Window_2 
  #Progression 
EndEnumeration 
;} 
;{ Menu bars 
Enumeration 
  #Menu_Window_0 
EndEnumeration 
;{ Menu items 
Enumeration 
  #Menu_Window_0_0_ExtraireUneArchive 
  #Menu_Window_0_0_OuvrirUneArchive 
  #Menu_Window_0_1_TesterUneArchive 
  #Menu_Window_0_2_MotDePasse 
  #Menu_Window_0_3_Configuration 
  #Menu_Window_0_4_Quitter 
  #Menu_Window_0_5_Compresser 
  #Menu_Window_0_6_CompresserAvecPassword 
  #Menu_Window_0_7_Decompresser 
  #Menu_Window_0_8_SupprimerPassword 
  #Menu_Window_0_9_TutorialPCDEVZIP 
  #Menu_Window_0_11_APropos 
EndEnumeration 
;} 
;{ Status bars 
Enumeration 
  #StatusBar_Window_0 
EndEnumeration 
;} 
;{ Gadgets 
Enumeration 
  #ExplorerComboGadget 
  #ExplorerList_1 
  #StatusBar 
  #compress 
  #decompress 
  #Text_10 
  #String_9 
  #Text_18 
  #String_17 
  #Button_12 
  #Frame3D_16 
  #Text_12 
  #ComboBox_13 
  #Text_14 
  #ComboBox_15 
  #Frame3DGadget_245 
  #TextGadget_244 
  #StringGadget_246 
  #TextGadget_243 
  #StringGadget_247 
  #CheckBoxGadget_242 
  #CheckBoxGadget_241 
  #ButtonGadget_240 
  #ButtonGadget_239 
  #ProgressBar
  #ProgressBar2
  #Txt1:#Txt2
  #Button_4
EndEnumeration 
Global Disk$ 
Disk$ = "C:\" 
Global Window_0, ProgressBar_Compression, Text_FileProcessed, Text_1, ProgressBar_Progression, Bt_Annuler
Global nom_archive.s,destination$,pwd$,pwd2$, repfichier$, *ZoneMemoire
;} 
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 170, 90, 652, 470, "Compressor Beta 210", #PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
    CreateGadgetList(WindowID(#Window_0))
    If CreateMenu(#Menu_Window_0, WindowID(#Window_0))
      MenuTitle("Menu")
      MenuItem(#Menu_Window_0_0_OuvrirUneArchive,"Ouvrir Archive")
      MenuItem(#Menu_Window_0_0_ExtraireUneArchive, "Extraire Archive")
      MenuItem(#Menu_Window_0_1_TesterUneArchive, "Tester Archive")
      MenuItem(#Menu_Window_0_2_MotDePasse, "Mot de passe")
      MenuItem(#Menu_Window_0_3_Configuration, "Configuration")
      MenuBar()
      MenuItem(#Menu_Window_0_4_Quitter, "Quitter")
      MenuTitle("Commandes")
      MenuItem(#Menu_Window_0_5_Compresser, "Compresser")
      MenuItem(#Menu_Window_0_6_CompresserAvecPassword, "Compresser avec Password")
      MenuBar()
      MenuItem(#Menu_Window_0_7_Decompresser, "Décompresser")
      MenuItem(#Menu_Window_0_8_SupprimerPassword, "Supprimer Password")
      MenuTitle("Aide")
      MenuItem(#Menu_Window_0_9_TutorialPCDEVZIP, "Tutorial(PC-DEV ZIP)")
      MenuItem(#Menu_Window_0_11_APropos, "A Propos")
      
      ExplorerComboGadget(#ExplorerComboGadget, 1, 02, 650, 200, Disk$, #PB_Explorer_Editable)
      ExplorerListGadget(#ExplorerList_1, 0, 25, 651, 405, Disk$, #PB_Explorer_MultiSelect|#PB_Explorer_AutoSort);|#PB_Explorer_FullRowSelect)
      SetGadgetItemAttribute(#ExplorerList_1, 0,#PB_Explorer_ColumnWidth, 347)
      ;CreateStatusBar(#StatusBar_Window_0, WindowID(Window_0))
      ; Gadget Resizing
      PureRESIZE_SetGadgetResize(#ExplorerList_1, 1, 1, 1, 1)
      PureRESIZE_SetGadgetResize(#ExplorerComboGadget, 1, 1, 1, 1)
      CreateStatusBar(#StatusBar, WindowID(0))
      AddStatusBarField(175)
      AddStatusBarField(480)
      StatusBarText(#StatusBar, 2, "Area 3", #PB_StatusBar_Right | #PB_StatusBar_Raised)
    EndIf
  EndIf
EndProcedure
  
Procedure OpenWindow_Archive() 
  If OpenWindow(#Window_2, 587, 257, 353, 350, "Add to Zip", #PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered) 
    SmartWindowRefresh(#Window_2, 1) 
    StickyWindow(#Window_2, 1) 
    If CreateGadgetList(WindowID(#Window_2)) 
      TextGadget(#Text_10, 7, 21, 80, 15, "Archive name") 
      StringGadget(#String_9, 92, 16, 221, 20, "") 
      TextGadget(#Text_18, 8, 55, 65, 15, "Destination") 
      StringGadget(#String_17, 92, 50, 220, 20, "") 
      ButtonGadget(#Button_12, 318, 51, 25, 20, "...") 
      
      Frame3DGadget(#Frame3D_16, 10, 85, 330, 85, "Compression Options") 
      TextGadget(#Text_12, 25, 105, 90, 15, "Archive Format") 
      ComboBoxGadget(#ComboBox_13, 220, 100, 105, 100):DisableGadget(#ComboBox_13,1) 
      AddGadgetItem(#ComboBox_13, 0, "Zip") 
      AddGadgetItem(#ComboBox_13, 1, "Arj") 
      AddGadgetItem(#ComboBox_13, 2, "Ace") 
      SetGadgetState(#ComboBox_13, 0) 
      
      TextGadget(#Text_14, 25, 135, 110, 15, "Type of compresssion") 
      ComboBoxGadget(#ComboBox_15, 220, 135, 105, 100):DisableGadget(#ComboBox_15,1) 
      AddGadgetItem(#ComboBox_15, 0, "Normal") 
      AddGadgetItem(#ComboBox_15, 1, "Deflate") 
      SetGadgetState(#ComboBox_15, 0) 
      
      Frame3DGadget(#Frame3DGadget_245, 10, 182, 330, 135, "Password") 
      TextGadget(#TextGadget_244, 20, 200, 118, 15, "Enter Password") 
      StringGadget(#StringGadget_246, 165, 235, 160, 20, "", #PB_String_Password) 
      TextGadget(#TextGadget_243, 20, 240, 128, 15, "Confirm Password") 
      StringGadget(#StringGadget_247, 165, 199, 160, 20, "", #PB_String_Password) 
      CheckBoxGadget(#CheckBoxGadget_242, 20, 269, 140, 15, "Show Password") 
      CheckBoxGadget(#CheckBoxGadget_241, 20, 294, 180, 15, "Crypt files name"):DisableGadget(#CheckBoxGadget_241,1) 
      ButtonGadget(#ButtonGadget_240, 218, 324, 60, 20, "OK") 
      ButtonGadget(#ButtonGadget_239, 288, 325, 54, 19, "cancel") 
      
    EndIf 
  EndIf 
EndProcedure 
  
Procedure AjouterAZip(Path.s) 
  Protected dir.l, entry.s, Rep.s, chaine.s
  If Not Right(Path, 1) = "\" : Path+"\" : EndIf
  dir = ExamineDirectory(#PB_Any, Path, "")
  If dir
    ;chaine = RemoveString(Path, Rep)
    ;Debug chaine
    While NextDirectoryEntry(dir)
      entry = DirectoryEntryName(dir)
      If entry = "." Or entry = ".."
        Continue
      ElseIf DirectoryEntryType(dir) = #PB_DirectoryEntry_File
        PureZIP_Archive_Compress(Path+entry,#True)
      Else
        AjouterAZip(Path+entry+"\")
    EndIf : Wend
    FinishDirectory(dir)
  EndIf
EndProcedure
Procedure CompresserArchive() 
  CloseWindow(#Window_2)
  If GetGadgetState(#ExplorerList_1) > -1 
    nom_archive$ = PeekS(*ZoneMemoire) 
    ; Debug nom_archive$ 
    If nom_archive$ And destination$ 
      PureZIP_Archive_Create(destination$+nom_archive$, #APPEND_STATUS_CREATE)
      dernier_element=CountGadgetItems(#ExplorerList_1)-1  
       For position_element=0 To dernier_element 
        etat_gadget=GetGadgetItemState(#ExplorerList_1,position_element)
         If etat_gadget & #PB_Explorer_Selected 
           If etat_gadget & #PB_Explorer_File
            SourceDir$ = GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1,position_element, 0)
             PureZIP_Archive_Compress(SourceDir$,#False)
          ElseIf etat_gadget & #PB_Explorer_Directory ; ... un répertoire
            SourceDir$ = GetGadgetText(#ExplorerList_1)+ GetGadgetItemText(#ExplorerList_1,position_element, 0)
            SetCurrentDirectory_(@SourceDir$)
            AjouterAZip(SourceDir$) 
          EndIf 
        EndIf  
      Next 
      PureZIP_Archive_Close()
    Else 
      MessageRequester("Compressor","Please check archive name and destination !",#MB_ICONERROR) 
    EndIf 
  Else 
    MessageRequester("Compressor","Please select files",#MB_ICONERROR) 
  EndIf
EndProcedure 
Procedure Ouvrir_Zip(filename.s)
  ZIP_Handle_Lecture = PureZIP_Archive_Read(filename)
  If ZIP_Handle_Lecture
    Nb_fichiers = PureZIP_GetFileCount(filename)-1
    For i = 0 To Nb_fichiers;:Debug Nb_fichiers
      PureZIP_GetFileInfo(filename,i , @myFileinfo.PureZIP_FileInfo)
      String.s = PeekS(@myFileinfo\filename)
      Debug String
      SetGadgetItemText(#ExplorerList_1,i,String, 0);affiche simplement les dossiers contenant le nom des fichiers
      ;SetGadgetText(#ExplorerList_Principale,String);affiche simplement un seul fichier
    Next
  EndIf
EndProcedure
Procedure ouvrir_Archive()
  Filtre$ = "Rar(*.rar)|*.rar;*.ZIP;*.tar;*.cab|7-zip(*.7-zip)|*.7zip|Arj(*.arj)|*.arj|Ace(*.ace)|*.ace|Toutes les archives (*.*)|*.*"
  Filtre  = 0
  NewFilename.s = OpenFileRequester("Sélectionner un archive", FichierParDefaut$, Filtre$, Filtre)
  If NewFilename <> ""
    Ouvrir_Zip(NewFilename)
    SetGadgetText(#ExplorerComboGadget,NewFilename)
  EndIf
EndProcedure
 
Procedure Open_Window() 
  Window_0 = OpenWindow(#PB_Any, 382, 285, 315, 128, "Compressor",#PB_Window_TitleBar | #PB_Window_ScreenCentered) 
  If Window_0 : StickyWindow(Window_0, 1) 
    If CreateGadgetList(WindowID(Window_0)) 
      ProgressBar_Compression = ProgressBarGadget(#PB_Any, 5, 25, 305, 20, 0, 100) 
      Text_FileProcessed = TextGadget(#PB_Any, 74, 4, 150, 15, "Files Extraction...", #PB_Text_Center) 
      Text_1 = TextGadget(#PB_Any, 100, 58, 100, 15, "Progression...", #PB_Text_Center) 
      ProgressBar_Progression = ProgressBarGadget(#PB_Any, 5, 77, 305, 20, 0, 100) 
      Bt_Annuler = ButtonGadget(#Button_4, 240, 106, 70, 18, "Cancel") 
    EndIf 
  EndIf 
EndProcedure
  
Procedure Close_Window() 
  CloseWindow(Window_0) 
EndProcedure 
Procedure PureZIP_CallbackP(File.s, PerCent.f)
  SetGadgetState(ProgressBar_Progression, PerCent.f)
  While WindowEvent() : Wend
EndProcedure
Procedure PureZIP_CallbackC(File.s, PerCent.f)
  SetGadgetText(Text_FileProcessed, GetFilePart(File))
  SetGadgetState(ProgressBar_Compression, PerCent.f)
  While WindowEvent() : Wend
EndProcedure
; 
;myFileinfo.PureZIP_FileInfo                          ;fonctionne pas bien
;PureZIP_SetProgressionCallback(@PureZIP_CallbackP()) ;fonctionne pas bien
;PureZIP_SetCompressionCallback(@PureZIP_CallbackC()) ;fonctionne pas bien
Procedure statusbar1() 
  Protected  Nombre_Elements 
  Nombre_Elements = CountGadgetItems(#ExplorerList_1) 
  
  If CreateStatusBar(#StatusBar_Window_0, WindowID(#Window_0)) 
    AddStatusBarField(175) 
    AddStatusBarField(480) 
    StatusBarText(#StatusBar_Window_0,0, Str(Nombre_Elements) + " "+"élément(s)") 
  EndIf
EndProcedure 
 
OpenWindow_Window_0() 
statusbar1() 
Repeat 
  Select WaitWindowEvent() 
    
    ; /////////////////// 
    Case #PB_Event_Menu 
      Select EventMenu() 
        Case #Menu_Window_0_5_Compresser 
          If GetGadgetState(#ExplorerList_1) > -1 
            OpenWindow_Archive() : SetGadgetText(#String_9,"Archive.zip") 
          Else:MessageRequester("Compressor","Please select files !",#MB_ICONERROR)  
          EndIf 
          
        Case #Menu_Window_0_7_Decompresser 
        Case #Menu_Window_0_0_ExtraireUneArchive
        Case #Menu_Window_0_0_OuvrirUneArchive :ouvrir_Archive()
        Case #Menu_Window_0_1_TesterUneArchive 
        Case #Menu_Window_0_2_MotDePasse
        Case #Menu_Window_0_3_Configuration
        Case #Menu_Window_0_4_Quitter:Break 
      EndSelect  
      
      ; //////////////////////
    Case #PB_Event_Gadget 
      EventGadget = EventGadget() 
      EventType = EventType() 
      Select EventGadget() 
        
        Case #ExplorerComboGadget 
          SetGadgetText(#ExplorerList_1, GetGadgetText(#ExplorerComboGadget)) 
          If  EventType() = #PB_EventType_Change 
            Nombre_Elements = CountGadgetItems(#ExplorerList_1) 
          StatusBarText(#StatusBar_Window_0,0, Str(Nombre_Elements) + " élément(s)") :EndIf 
          
        Case #ButtonGadget_239 
          CloseWindow(#Window_2) 
          
        Case #ButtonGadget_240 ;archivage des fichiers
          nom_archive$ = GetGadgetText(#String_9) 
          destination$ = GetGadgetText(#String_17) 
          pwd$ = GetGadgetText(#StringGadget_246) 
          pwd2$ = GetGadgetText(#StringGadget_246) 
          
          *ZoneMemoire = AllocateMemory(2500) 
          *Pointeur = *ZoneMemoire
          PokeS(*ZoneMemoire, nom_archive$)
          
          If  nom_archive$ <> "" And destination$ <> "" And pwd$ = pwd2$ And pwd$ = "" And pwd2$ = "" 
            CloseWindow(#Window_2): SetWindowState(#Window_0,#PB_Window_Minimize)
            Open_Window(): CompresserArchive():FreeMemory(*ZoneMemoire):Close_Window()
            SetWindowState(#Window_0,#PB_Window_Normal)
          EndIf 
          
        Case #ExplorerList_1 
          If  EventType() = #PB_EventType_LeftDoubleClick 
          SetGadgetText(#ExplorerComboGadget,GetGadgetText(#ExplorerList_1)): EndIf 
        Case Bt_Annuler
          End
      EndSelect 
      
      ; //////////////////////    
    Case #PB_Event_CloseWindow 
      EventWindow = EventWindow() 
      If EventWindow = #Window_0 
        Break 
      ElseIf EventWindow = #Window_2 
        CloseWindow(#Window_2) 
      EndIf 
  EndSelect 
ForEver