DeleteFolderIcon Example

InstallShield 2024 » InstallScript Language Reference

Note:To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

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

*

* InstallShield Example Script

*

* Demonstrates the DeleteFolderIcon and DeleteProgramFolder

* functions.

*

* This script deletes the 'Notepad Example' icon from the

* 'Example folder' folder.  DeleteProgramFolder is then

* called again to delete this folder.

*

* Note: In order for this script to run properly, you must set

*       the preprocessor constants to a valid folder and icon

*       on the target system.  To easily create this example

*       folder and icon, run the AddFolderIcon example #3.

*

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

 

#define FOLDER "C:\\Windows\\Example folder"

#define ICON   "Notepad Example"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_DeleteFolderIcon(HWND);

 

function ExFn_DeleteFolderIcon(hMSI)

begin

 

    // Display the folder.

    ShowProgramFolder (FOLDER, SW_SHOW);

    Delay (3);

 

    // Delete the 'Notepad Example' icon.

    if (DeleteFolderIcon (FOLDER, ICON) < 0) then

        MessageBox ("DeleteFolderIcon failed.", SEVERE);

    endif;

 

    // Delete the 'Example folder' icon.

    if (DeleteProgramFolder (FOLDER) < 0) then

        MessageBox ("DeleteProgramFolder failed.", SEVERE);

    endif;

 

end;