正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!
您需要 登录 才可以下载或查看,没有账号?立即注册
x
判断软件是否已经被安装过
- #include "ifx.h"
- prototype IsProductWasInstalled();
- function OnBegin()
- begin
- // TODO: Perform custom initialization steps, check requirements, etc.
- if IsProductWasInstalled() then
- MessageBox("产品已经被安装过", MB_OK);
- endif;
- end;
- function IsProductWasInstalled()
- BOOL bRc;
- begin
- if (MAINTENANCE != 0) then
- // 产品已经被安装过
- bRc = TRUE;
- else
- // 产品首次被安装(还没有被安装,本次安装是首次)
- bRc = FALSE;
- endif;
- return bRc;
- end;
复制代码
安装完成后,从目标文件夹中拷贝文件或文件夹到另外的自定义目录
在installShield2010SP1中, ComponentSetTarget 失效,无法在纯脚本工程中才做自定义的脚本文件夹(e.g. 拷贝自定义文件夹到另外的目录). FeatureSetTarget 没用明白.
最后想起用CopyFile试试. 最后A君用XCopyFile搞定.
我用CopyFile实验时,原路径搞错了, 调整了半天。 最后也可以用,只有麻烦。
还是用XCopyFile好用.
- //---------------------------------------------------------------------------
- // The Installed event is sent after the feature DefaultFeature
- // is installed.
- //---------------------------------------------------------------------------
- prototype fn_myCopy();
- prototype fn_myXCopy();
- export prototype DefaultFeature_Installed();
- function DefaultFeature_Installed()
- begin
- if (!REMOVEALLMODE) then
- fn_myCopy(); ///< 手动拷贝, 验证ok
- fn_myXCopy(); ///< 这个A君搞的, 调用起来更方便
- endif;
- end;
- function fn_myXCopy()
- STRING strDirSrc;
- STRING strDirDst;
- begin
- strDirSrc = TARGETDIR;
- strDirDst = "d:\\rc_xcopy\";
- if(XCopyFile(strDirSrc ^ "*.*", strDirDst,INCLUDE_SUBDIR) < 0) then
- MessageBox("释放文件失败",SEVERE);
- abort;
- endif;
- end;
- function fn_myCopy()
- STRING strDirSrc;
- STRING strDirDst;
- STRING strPathNameSrc;
- STRING strPathNameDst;
- STRING strTemp;
- begin
- strDirSrc = TARGETDIR;
- strDirDst = "d:\\rc_copy\";
- // 建立目标文件夹
- CreateDir(strDirDst);
- strTemp = strDirDst ^ "copy_to_our_resource_dir\";
- CreateDir(strTemp);
- strTemp = strDirDst ^ "direct_copy_to_our_resource_dir\";
- CreateDir(strTemp);
- strPathNameSrc = TARGETDIR ^ "copy_to_install_dir\\*.*";
- strPathNameDst = strDirDst ^ "*.*";
- CopyFile(strPathNameSrc, strPathNameDst);
- // 拷贝源文件子目录到目标目录的子目录
- strPathNameSrc = strDirSrc ^ "copy_to_install_dir\\copy_to_our_resource_dir\\*.*";
- strPathNameDst = strDirDst ^ "copy_to_our_resource_dir\\*.*";
- CopyFile(strPathNameSrc, strPathNameDst);
- strPathNameSrc = strDirSrc ^ "copy_to_install_dir\\direct_copy_to_our_resource_dir\\*.*";
- strPathNameDst = strDirDst ^ "direct_copy_to_our_resource_dir\\*.*";
- CopyFile(strPathNameSrc, strPathNameDst);
- end;
复制代码
|