SdExceptions Example

InstallShield 2019 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* The SdExceptions function displays a dialog informing the

* end user that a shared, locked (in use), or read-only file has

* been encountered and offering appropriate options.

*

* The SdExcpetions function is used in the default code

* for the following Miscellaneous event handlers:

*

* OnFileLocked

* OnFileReadOnly

* OnRemovingSharedFile

*

* The sample script below uses the OnFileReadOnly event.  To get

* the SdExceptions prompt, the setup must attempt to overwrite or

* uninstall a read-only file.

*

\*--------------------------------------------------------------*/

 

#include "Ifx.h"

 

//---------------------------------------------------------------------------

// OnFileReadOnly

//

// The OnFileReadOnly event is called when a read-only file needs to be

// installed or uninstalled.

//

// szFile will contain the full path of the file that is read-only when the

// event is called.

//

// The event should return one of the following values:

//

// ERR_YES - Indicates that the file should be installed or uninstalled,

//

// ERR_NO - Indicates that the file should not be installed or uninstalled.

//---------------------------------------------------------------------------

function OnFileReadOnly(szFile)

begin

    // TODO: Enable this code if you want to return ERR_YES and simply

    // install or uninstall the read-only file w/o confirmation.

    // return ERR_YES;

 

    return SdExceptions(READONLY, szFile);

 

end;