InstallShield 常用操作

//安装完成后执行某些操作并将其删除
function OnFirstUIAfter()
begin   
  TARGETDIR = PROGRAMFILES ^@COMPANY_NAME ^@PRODUCT_NAME
  LaunchAppAndWait(TARGETDIR^"FtpConfig.bat","" ,WAIT);
  DeleteFile("FtpConfig.bat");
end;
//验证序列号
在function OnFirstUIBefore()中的
Dlg_SdRegisterUserEx:里nResult下面添加:
 if  szSerial!=("e43f2811-6643-4742-8c0a-08a9db9df188") && (nResult = NEXT) then 
     MessageBox( "您录入的注册码不正确!", WARNING );
     goto start;
     endif;
//卸载程序
function OnMoved()
STRING szWorkingDir,szIconPath,szItemName,svTmp,szParam;
STRING szProgram,szCommandLine,szShortCutKey,szProgramFolder;
NUMBER nResult,nFlag,nIcon;
begin
 if !MAINTENANCE then
 szProgramFolder =FOLDER_PROGRAMS+@PRODUCT_NAME;
 szWorkingDir    = TARGETDIR;
 szIconPath      = PROGRAMFILES^@COMPANY_NAME ^@PRODUCT_NAME+'\\uninstall.ICO';
 nIcon           =0;
 szItemName      = "卸载little-oa";
 //szProgram       = szIconPath;
 svTmp  = PROGRAMFILES+"InstallShield Installation Information\\"+PRODUCT_GUID+"\\setup.exe";
 LongPathToQuote(svTmp, TRUE);
 szParam         = svTmp;
 LongPathToShortPath(szParam);
 svTmp  = COMMONFILES+"InstallShield\\engine\\6\\Intel 32\\ctor.dll";
 LongPathToShortPath(svTmp);
 szProgram       = "RunDll32"+" "+ svTmp+",LaunchSetup";
 szCommandLine = szProgram + " " + szParam;
 //RunDll32 D:\PROGRA~1\COMMON~1\INSTAL~1\ENGINE\6\INTEL3~1\ctor.dll,LaunchSetup "D:\Program Files\InstallShield Installation Information\PRODUCT_GUID+"\\setup.exe"
//szProgramFolder中的@PRODUCT_NAME要与开始->程序->()->shortcut中的()的名称要一样,这样卸载才能加到开始->程序->()中去.
 if (AddFolderIcon(szProgramFolder, szItemName, szCommandLine, szWorkingDir,
                   szIconPath, nIcon, szShortCutKey, nFlag) < 0) then
    return -1;
 endif;
 AddFolderIcon(szProgramFolder, szItemName, szCommandLine, szWorkingDir,
                   szIconPath, nIcon, szShortCutKey, nFlag);
 nResult = CreateShellObjects( "" );
 
 if nResult <0 then
  return nResult;
 else             
  ShowProgramFolder (szProgramFolder,SW_SHOW);
  return nResult;
 endif;

endif;
end;

posted @ 2010-12-10 22:42  天空行马  阅读(427)  评论(0编辑  收藏  举报