您的位置:首页 > 其它

installshield动态创建快捷方式

2008-01-15 11:05 381 查看
帮助文档里的函数
/*-----------------------------------------------------------*/
*
* 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 "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 szShortCutKey, szProgram, szParam, szIconPath;
    NUMBER nIcon;
begin
    // Set up parameters for call to AddFolderIcon.
    szProgramFolder = FOLDER_STARTMENU;
    szItemName      = "Notepad Example 1";
    szProgram       = PROGRAM;
    szParam         = PARAM;
    LongPathToQuote (szProgram, TRUE);
    LongPathToShortPath (szParam);
    szCommandLine = szProgram + " " + szParam;
    szWorkingDir  = "";
    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 createdsuccessfully.",
                   szItemName);
    endif;
    szProgramFolder = "";
    szItemName    = "Notepad Example 2";
    // 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 createdsuccessfully.",
                   szItemName);
    endif;
end;
Powered by ScribeFire.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: