PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Creating a self-extracting archive
  • Creating a self-extracting archive
zipCreateExe (Example)
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 found 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
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment