CreateShellObjects Example

InstallShield 2025 » InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the CreateShellObjects and CreateRegistrySet

* functions.

*

* Note: To run this example, you must create a project that

*       specifies registry entries and shell objects in the

*       Resources pane of the IDE.

*

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

 

 

export prototype ExFn_CreateShellObjects(HWND);

 

function ExFn_CreateShellObjects(hMSI)

    NUMBER ndisk;

    STRING szPassword;

    STRING svDir;

begin

 

    //Set the default target for copying files.

    svDir = "C:\\temp";

    

    // Get a target location from the user.

    AskDestPath ("","",svDir,0);

    

    // Assign the specified target location to

    // the corresponding system variable.

    INSTALLDIR = svDir;

    

    // Enable the progress indicator.

    SetStatusWindow (0, "");

    Enable (STATUS);

    StatusUpdate (ON, 100);

    

    // Transfer files.

    if (ComponentMoveData (MEDIA,ndisk,0) < 0 ) then

        MessageBox ("Error in moving data",SEVERE);

        abort;

    endif;

    

    //Create the Registry sets that were defined in the Resources pane.

    if (CreateRegistrySet ("") < 0) then

        MessageBox ("Unable to create registry set.",SEVERE);

        abort;

    endif;

    

    //Create the Shell objects that were defined in the Resources pane.

    if (CreateShellObjects ("") < 0) then

        MessageBox ("Unable to create shell objects.",SEVERE);

        abort;

    endif;

 

end;