- Creating a self-extracting archive
- Creating a self-extracting archive
Creating a self-extracting archive The following code is used to create a self-extracting archive. The archived files are extracted from the current directory. The "Icon.ICO" file is located in the runtime directory of the application.
// Declare and initialize the variables ErrorCodeOpening is int ErrorCodeExe is int // Open an archive ErrorCodeOpening = zipOpen("MyArchive", "C:\MyArchives\MyArchive.WDZ") IF ErrorCodeOpening = 0 THEN // Create a self-extracting archive ErrorCodeExe = zipCreateExe("MyArchive", ... "D:\Backups\Archive.EXE", zipCurrentDirectory, "Icon.ICO") // Display the error message // if the self-extracting archive was not created IF ErrorCodeExe <> 0 THEN Error(zipMsgError(ErrorCodeExe)) END ELSE // Display an error message if the opening was not performed Error(zipMsgError(ErrorCodeOpening)) END
Creating a self-extracting archive The following code is used to create an archive containing a file, then a self-extracting archive.
// Declare and initialize the variables ErrorCodeOpening is int ErrorCodeExe is int // Create the archive nResCreate is int = zipCreate("MyArchive","C:\Temp\MyArchive.WDZ") IF nResCreate = 0 THEN // Add a file into an archive nResAddFile is int = zipAddFile("MyArchive", ... CompleteDir(fExeDir) + "Test.txt", zipDrive) END zipClose("MyArchive") ErrorCodeOpening = zipOpen("MyArchive", "C:\Temp\MyArchive.WDZ") IF ErrorCodeOpening = 0 THEN // Create a self-extracting archive ErrorCodeExe = zipCreateExe("MyArchive", "C:\Temp\Archive.EXE", ... zipCurrentDirectory, "Icon.ICO") // Display the error message // if the self-extracting archive was not created IF ErrorCodeExe <> 0 THEN Error(zipMsgError(ErrorCodeExe)) END ELSE // Display an error message if the opening was not performed Error(zipMsgError(ErrorCodeOpening)) END
This page is also available for…
|
|
|
|