Xceed .NET Libraries Documentation
ExecuteAfter Property


Xceed.Zip Assembly > Xceed.Zip.Sfx Namespace > XceedSfxPrefix Class : ExecuteAfter Property
Gets the path and filenames of one or more external programs or executables that the self-extracting zip file will run upon successfully extracting its files.
Syntax
'Declaration
 
Public ReadOnly Property ExecuteAfter As StringList
'Usage
 
Dim instance As XceedSfxPrefix
Dim value As StringList
 
value = instance.ExecuteAfter
public StringList ExecuteAfter {get;}

Property Value

A reference to a StringList object representing the external programs or executables that the self-extracting zip file will run upon successfully extracting its files.

Parameters for the executable can also be specified by separating them from the executable using a pipe (|) character.

For example, the string "notepad.exe|d:\test.txt" will execute notepad.exe with d:\test.txt as a parameter.

 

Remarks

Variables

The following Variables are available when specifying a value for the ExecuteAfter property:

<SfxFolder> The folder where the self-extracting zip file is being run from.
<WindowsFolder> The location of the Windows folder.
<SystemFolder> The location of the Windows System folder.
<TempFolder> The location of the system's temporary folder.
<RandomFolder> Random folder name that doesn't already exist. (the format of the random name is: _SFXxxx, where xxx is a random number)
<ProgramFilesFolder> The location of the Program Files folder.
<SystemDrive> The main system hard disk.
<DestinationFolder> The unzipping folder or the user-selected folder where files were unzipped to.

The DeleteUnzippedFiles property affects when each program is executed. When DeleteUnzippedFiles is true, each executable will be run in the specified sequence, but only after the previous one has terminated. When DeleteUnzippedFiles property is false, all executables will be run one after the other without waiting for each one to terminate before running the next.

The length of the values of the ExecuteAfter, FilesToCopy, DllsToRegister and RegistryKeys properties cannot exceed 2000 characters.

This property is the equivalent of the SfxExecuteAfter and SfxReadmeFile properties and the SfxAddExecuteAfter method of the ActiveX version of Xceed Zip.

Using ShellExecuteEx()

By default way the binary module will run programs using the Windows function CreateProcess(). It is possible to use the ShellExecuteEx() function instead, which starts programs using a "verb" as it would be done using Windows Explorer.

To usem the application name in the ExecuteAfter string must be prefixed with #S<verb>|

#S means that the Windows function ShellExecuteEx() will be used to start the application instead of the usual CreateProcess().

<verb> is an 'object verb'. These are essentially the items that you find on an object's shortcut menu in Windows Explorer. A very common verb is runas. It instructs the function to 'run as administrator' the specified application.

| acts as a separator between the verb and the application name.

So for example, an ExecuteAter entry could look like this:

#Srunas|%d\MyProgram.exe Arg1 Arg2

Any verb supported by the application or document can be used. The self-extractor will simply pass it on to ShellExecuteEx() unmodified. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs.

Using #S implies that the return code will be part of the self-extractor's exit code. See below for details.

Return codes

If you prefix the application name with the string #E or #e, that application's exit code will be used as part of the self-extractor's exit code.

Applications who don't use the #E/#e prefix, the default behavior, will have their exit code ignored.

For example, the string "#E%myapplication.exe|/option1 /option2"

Limitations: ExecuteAfter is only used if the unzip operation succeeds without issue. If the unzip operation fails, the applications listed by ExecuteAfter are not run and the exit code will be an Xceed error number, usually >= 100. The self-extractor offers no reliable way to determine if an error code comes from the unzip operation or from the ExecuteAfter. If the unzip succeeds, the ExecuteAfter applications are run. All ExecuteAfter applications are run regardless of their exit code. If more than one application uses the #E prefix, the largest exit code that is returned is used as the exit code.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

XceedSfxPrefix Class
XceedSfxPrefix Members

Windows Documentation

ShellExecuteEx()
Launching applications