InstallShield 2016 » 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 AddFolderIcon function.
*
* This example creates a cascading submenu on the Startup menu
* and adds a shortcut for an executable file to it.
*
* Note: Before running this script, set the preprocessor
* constants so that they reference the fully qualified
* names of the Windows Notepad executable file and a
* valid text file on the target system.
*
\*-----------------------------------------------------------*/
#define PROGRAM "C:\\Windows\\Notepad.exe"
#define PARAM "C:\\Windows\\Readme.txt"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_AddFolderIcon(HWND);
function ExFn_AddFolderIcon(hMSI)
STRING szProgramFolder, szItemName, szCommandLine, szWorkingDir;
STRING szIconPath, szShortCutKey, szProgram, szParam;
NUMBER nIcon, nFlag, nResult;
begin
// Set the fully qualified name of the Startup submenu.
szProgramFolder = FOLDER_STARTUP ^ "SubMenu Example";
// Construct the shortcut’s command-line property.
szProgram = PROGRAM;
szParam = PARAM;
LongPathToQuote (szProgram, TRUE);
LongPathToShortPath (szParam);
szCommandLine = szProgram + " " + szParam;
// Set up the shortcut’s other properties to pass to AddFolderIcon.
szItemName = "Notepad Example1";
szWorkingDir = "";
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
nFlag = REPLACE|RUN_MAXIMIZED;
// Add the shortcut to the submenu; create the submenu if necessary.
nResult = AddFolderIcon (szProgramFolder, szItemName, szCommandLine,
szWorkingDir, szIconPath, nIcon,
szShortCutKey, nFlag);
// Report the results.
if (nResult < 0) then
MessageBox ("AddFolderIcon failed.", SEVERE);
else
SprintfBox (INFORMATION, "AddFolderIcon", "%s created successfully.",
szItemName);
endif;
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |