/*-----------------------------------------------------------*/
*
* InstallShield Example Script
*
* Demonstrates the AddFolderIcon function.
*
* This example places a shortcut to an executable file on the
* Start menu and the Start Programs menu.
*
* Note: Before running this script, set the preprocessor
* constants so that they reference the fully qualified
* names of the Windows Notepad executable and a valid
* text file on the target system.
*
/*-----------------------------------------------------------*/
#define PROGRAM TARGETDIR ^ "Notepad.exe"
#define PARAM TARGETDIR ^ "回忆校园.txt"
function ExFn_AddFolderIcon(szName)
STRING szProgramFolder, szItemName, szCommandLine, szWorkingDir;
STRING szShortCutKey, szProgram, szParam, szIconPath;
NUMBER nIcon;
begin
// Set up parameters for call to AddFolderIcon.
szProgramFolder = FOLDER_STARTMENU;
szItemName = "Notepad Example 1 " + szName;
szProgram = PROGRAM;
szParam = PARAM;
LongPathToQuote (szProgram, TRUE);
LongPathToShortPath (szParam);
szCommandLine = szProgram + " " + szParam;
szWorkingDir =TARGETDIR;
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
// Add a shortcut to the Start menu.
if (AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir,
szIconPath, nIcon, szShortCutKey, REPLACE) < 0) then
MessageBox ("AddFolderIcon failed.", SEVERE);
else
SprintfBox (INFORMATION, "AddFolderIcon", "%s created successfully.",
szItemName);
endif;
szProgramFolder = TEST;
szItemName = "Notepad Example 2 " + szName;
// Add a shortcut to the Programs menu.
if (AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir,
szIconPath, nIcon, szShortCutKey, REPLACE) < 0) then
MessageBox ("AddFolderIcon failed.", SEVERE);
else
SprintfBox (INFORMATION, "AddFolderIcon", "%s created successfully.",
szItemName);
endif;
end;
使用
ExFn_AddFolderIcon("Test2");
根据帮助的例子修改。