方法如下:
prototype CreateUninstallShortcut(); //放在#include "ifx.h"后
//将该函数的代码加到安装脚本setup.rul中
function CreateUninstallShortcut()
string strCmdLine;
LIST lstPath;
begin
// For an InstallScript installation:
strCmdLine = DISK1TARGET ^ "Setup.exe";
// For an InstallScript MSI installation:
strCmdLine = UNINSTALL_STRING;
// The path has to be handled differently if you are running
// an InstallScript MSI installation on Windows 9X.
if ( SYSINFO.WIN9X.bWin9X ) then
lstPath = ListCreate( STRINGLIST );
StrGetTokens( lstPath, UNINSTALL_STRING, "/" );
ListGetFirstString( lstPath, strCmdLine );
LongPathToQuote( strCmdLine, TRUE );
strCmdLine = strCmdLine + " /M" + PRODUCT_GUID;
endif;
AddFolderIcon(FOLDER_PROGRAMS ^ szProjectName, "卸载",strCmdLine, "",TARGETDIR^"Uninstall.ico",0, "", REPLACE );
end;
最后只需在OnFirstUIBefore函数return之前调用下这个函数就可以了,但有实际使用中有两个方面需要注意:
1:szProjectName根据实际情况填写:如果你的程序安装后为“开始||程序||Simple||卸载”则需该为FOLDER_PROGRAMS ^ "Simple", 如果为“开始||程序||Simple||Simple||卸载”则改为FOLDER_PROGRAMS ^ "Simple//Simple"。
2:TARGETDIR^"Uninstall.ico"根据实际情况填写:即ICO文件所在的目录^ICO文件的名称。