杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2026|回复: 0

操作整理

[复制链接]
发表于 2017-3-1 18:34:15 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
判断软件是否已经被安装过
  1. #include "ifx.h"

  2. prototype IsProductWasInstalled();

  3. function OnBegin()
  4. begin
  5.     // TODO: Perform custom initialization steps, check requirements, etc.
  6.     if IsProductWasInstalled() then
  7.         MessageBox("产品已经被安装过", MB_OK);
  8.     endif;
  9. end;                              

  10. function IsProductWasInstalled()
  11.     BOOL bRc;
  12. begin
  13.     if (MAINTENANCE != 0) then
  14.         // 产品已经被安装过
  15.         bRc = TRUE;
  16.     else
  17.         // 产品首次被安装(还没有被安装,本次安装是首次)
  18.         bRc = FALSE;
  19.     endif;                    

  20.     return bRc;
  21. end;
复制代码

安装完成后,从目标文件夹中拷贝文件或文件夹到另外的自定义目录

在installShield2010SP1中, ComponentSetTarget 失效,无法在纯脚本工程中才做自定义的脚本文件夹(e.g. 拷贝自定义文件夹到另外的目录). FeatureSetTarget 没用明白.
最后想起用CopyFile试试. 最后A君用XCopyFile搞定.
我用CopyFile实验时,原路径搞错了, 调整了半天。 最后也可以用,只有麻烦。
还是用XCopyFile好用.
  1. //---------------------------------------------------------------------------
  2. // The Installed event is sent after the feature DefaultFeature
  3. // is installed.
  4. //---------------------------------------------------------------------------

  5. prototype fn_myCopy();
  6. prototype fn_myXCopy();

  7. export prototype DefaultFeature_Installed();
  8. function DefaultFeature_Installed()
  9. begin     
  10.     if (!REMOVEALLMODE) then
  11.     fn_myCopy(); ///< 手动拷贝, 验证ok
  12.     fn_myXCopy(); ///< 这个A君搞的, 调用起来更方便
  13.     endif;
  14. end;                  

  15. function fn_myXCopy()
  16. STRING strDirSrc;
  17. STRING strDirDst;
  18. begin
  19.     strDirSrc = TARGETDIR;
  20.     strDirDst = "d:\\rc_xcopy\";
  21.     if(XCopyFile(strDirSrc ^ "*.*", strDirDst,INCLUDE_SUBDIR) < 0) then
  22.         MessageBox("释放文件失败",SEVERE);
  23.         abort;
  24.     endif;
  25. end;

  26. function fn_myCopy()
  27. STRING strDirSrc;
  28. STRING strDirDst;
  29. STRING strPathNameSrc;
  30. STRING strPathNameDst;   
  31. STRING strTemp;
  32. begin
  33.     strDirSrc = TARGETDIR;
  34.     strDirDst = "d:\\rc_copy\";

  35.     // 建立目标文件夹                        
  36.     CreateDir(strDirDst);

  37.     strTemp = strDirDst ^ "copy_to_our_resource_dir\";
  38.     CreateDir(strTemp);

  39.     strTemp = strDirDst ^ "direct_copy_to_our_resource_dir\";
  40.     CreateDir(strTemp);

  41.     strPathNameSrc = TARGETDIR ^ "copy_to_install_dir\\*.*";
  42.     strPathNameDst = strDirDst ^ "*.*";
  43.     CopyFile(strPathNameSrc, strPathNameDst);

  44.     // 拷贝源文件子目录到目标目录的子目录                     
  45.     strPathNameSrc = strDirSrc ^ "copy_to_install_dir\\copy_to_our_resource_dir\\*.*";
  46.     strPathNameDst = strDirDst ^ "copy_to_our_resource_dir\\*.*";
  47.     CopyFile(strPathNameSrc, strPathNameDst);

  48.     strPathNameSrc = strDirSrc ^ "copy_to_install_dir\\direct_copy_to_our_resource_dir\\*.*";
  49.     strPathNameDst = strDirDst ^ "direct_copy_to_our_resource_dir\\*.*";
  50.     CopyFile(strPathNameSrc, strPathNameDst);
  51. end;
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 18:52 , Processed in 0.100448 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表