InstallShield 2015 ยป 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 ReplaceFolderIcon function.
*
* Note: In order for this script to run correctly, you must set
* preprocessor constants to valid file names and a path
* on the target system. To easily create this example
* folder and icon, run the AddFolderIcon example #3.
*
\*--------------------------------------------------------------*/
#define FOLDER "C:\\Windows\\"
#define NEW_PROGRAM "C:\\WINDOWS\\WRITE.EXE"
#define NEW_PARAM "C:\\WINDOWS\\README.TXT"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ReplaceFolderIcon(HWND);
function ExFn_ReplaceFolderIcon(hMSI)
STRING szProgramFolder, szItemName, szNewItem, szCmdLine, szWorkingDir;
STRING szShortCutKey, szIconPath, szProgram, szParam;
NUMBER nIcon, nFlag;
begin
szProgramFolder = FOLDER ^ "Example folder";
szItemName = "Notepad Example";
szNewItem = "New Wordpad Example";
// Make sure the space is not seen as a delimiter.
szProgram = NEW_PROGRAM;
LongPathToQuote (szProgram, TRUE);
szParam = NEW_PARAM;
LongPathToShortPath(szParam);
szCmdLine = szProgram + " " + szParam;
szWorkingDir = "";
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
nFlag = REPLACE|RUN_MAXIMIZED;
// Display the folder on the screen.
ShowProgramFolder (szProgramFolder, SW_SHOW);
// Replace the "Notepad Example" icon with "New Wordpad Example".
if (ReplaceFolderIcon (szProgramFolder, szItemName, szNewItem, szCmdLine,
szWorkingDir, szIconPath, nIcon, szShortCutKey,
nFlag) < 0) then
MessageBox ("ReplaceFolderIcon failed.", SEVERE);
else
MessageBox ("Icon successfully replaced.", INFORMATION);
endif;
end;
InstallShield 2015 Help LibraryJune 2015 |
Copyright Information | Contact Us |