Vous pouvez ouvrir l'image nouvellement crée avec Winrar ou 7Zip par exemple.
Ce code fonctionne sous Window 7 et je ne l'ai pas testé avec Window XP.
Il ne demande qu'à être améliorer.
Code : Tout sélectionner
;ZipToImage V1.01 - By falsam
;
;PB 4.51+ - Window 7
EnableExplicit
Enumeration
#FontApp
#Mainform
#File_Image
#File_Zip
#File_Final
#Select_Image
#Select_Zip
#Select_Final
#Run
EndEnumeration
Define.l Event, WEvent, MEvent, GEvent, TEvent
Global WindowStyle.i=#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered
Global File_Image.s, File_Zip.s, File_Final.s, File.s, Pattern.s, Cmd.s
Procedure Open_MainForm()
OpenWindow(#Mainform, 0, 0, 500, 250, "Cacher des données dans une image", WindowStyle)
TextGadget(#File_Image, 20, 30, 400, 24, "Your image file", #PB_Text_Border)
SetGadgetColor(#File_Image, #PB_Gadget_BackColor, #White)
SetGadgetColor(#File_Image, #PB_Gadget_FrontColor, RGB(140, 140, 140))
ButtonGadget(#Select_Image, 430, 30, 24, 24, "?")
TextGadget(#File_zip, 20, 70, 400, 24, "Your zip file", #PB_Text_Border)
SetGadgetColor(#File_Zip, #PB_Gadget_BackColor, #White)
SetGadgetColor(#File_Zip, #PB_Gadget_FrontColor, RGB(140, 140, 140))
ButtonGadget(#Select_Zip, 430, 70, 24, 24, "?")
StringGadget(#File_Final, 20, 110, 400, 24, "Your final image.gif")
SetGadgetColor(#File_final, #PB_Gadget_BackColor, #White)
ButtonGadget(#Select_final, 430, 110, 24, 24, "?")
ButtonGadget(#Run, 200, 150, 100, 24, "Execute")
EndProcedure
Procedure Start()
;Font Application
LoadFont(#FontApp, "Arial", 10)
SetGadgetFont(#PB_Default,FontID(#FontApp))
Open_MainForm()
EndProcedure
start()
Repeat
Event = WaitWindowEvent(10)
WEvent = EventWindow()
MEvent = EventMenu()
GEvent = EventGadget()
TEvent = EventType()
Select Event
Case #PB_Event_Gadget
Select GEvent
Case #Select_Image, #Select_Zip, #Select_Final
If GEvent = #Select_Image Or GEvent = #Select_Final
Pattern = "*.GIF|*.GIF"
Else
Pattern = "*.ZIP|*.ZIP"
EndIf
File = OpenFileRequester("Choississez un fichier", "", Pattern, 0)
If File
Select GEvent
Case #Select_Image
SetGadgetText(#File_Image, File)
Case #Select_Zip
SetGadgetText(#File_zip, File)
Case #Select_Final
If Not FindString(File, ".gif")
File + ".gif"
EndIf
SetGadgetText(#File_Final, File)
EndSelect
EndIf
Case #Run
File_Image = GetGadgetText(#File_Image)
File_Zip = GetGadgetText(#File_Zip)
File_Final = GetGadgetText(#File_Final)
If Not FindString(File_Final, ".gif")
File_Final + ".gif"
EndIf
If ReadFile(#PB_Any, File_Image) And ReadFile(#PB_Any, File_zip)
Cmd = " /c copy /B "
Cmd + Chr(34)+File_Image+Chr(34)
Cmd + "+"
Cmd + Chr(34)+File_Zip+ Chr(34)
Cmd + " "
Cmd + Chr(34)+File_Final+Chr(34)
RunProgram("cmd.Exe", Cmd, "", #PB_Program_Wait|#PB_Program_Hide)
If ReadFile(#PB_Any, File_Final)
MessageRequester("Information", "Création du fichier terminé.")
Else
MessageRequester("Information", "Une erreur c'est produite lors de la constritution du fichier.")
EndIf
Else
MessageRequester("Information", "Un des fichiers (ou les deux) est invalide")
EndIf
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver