installshield动态创建快捷方式

来源:互联网 发布:宝宝唐装的淘宝 编辑:程序博客网 时间:2024/06/10 03:12
帮助文档里的函数
/*-----------------------------------------------------------*/

 *

 * 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 created 
successfully.",

                   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 created 
successfully.",

                   szItemName);

    endif;


end;


Powered by ScribeFire.