• [InstallShield]FindAllFiles与SetFileInfo配合实现文件加多文件属性设置


    很荣幸,InstallShield提供了函数SetFileInfo,但是很遗憾该还属却不支持文件夹整体修改。

    首先试验用WinApi SetFileAttributsA,失败了!不知原因何故!

    没有办法只能用InstallShield提供的FindAllFiles与SetFileInfo配合实现修改整个文件夹的文件属性设置。

    function SetFileArrtibuteNomal(svDir)

      string svResult, svFileSpec, svMatchingFileName;

      int      nResult, nvResult;

    begin

      svFileSpec=“*.*”;

      svMatchingFileName = "";

      //find the first file form folder

      nResult = Find AllFiles(svDir, svFileSpec, svMatchingFileName, RESET);

      while(nResult = 0)

        if(GetFileInfo(svMatchingFileName, FILE_ATTRIBUTE, nvResult, svResult) = 0) then

          if(nvResult = FILE_ATTR_NOMAL) then

            //the file is nomal;

          else

            if(FILE_ATTR_HIDDEN & nvResult ) then

              //the file is hidden;

              SetFileInfo(svMatchingFileName, FILE_ATTRIBUTE, FILE_ATTER_NOMAL,"");

            endif; 

            if(FILE_ATTR_READONLY & nvResult ) then 

              //the file is read-only;

              SetFileInfo(svMatchingFileName, FILE_ATTRIBUTE, FILE_ATTER_NOMAL,"");

            endif;

          endif;

        endif;

        //find the next file

        nResult = Find AllFiles(svDir, svFileSpec, svMatchingFileName, CONTINUE);  

      endwhile;

      //release the files

      nResult = Find AllFiles(svDir, svFileSpec, svMatchingFileName, CANCEL);  

    end;

    以上代码在InstallShield2009测试通过!

  • 相关阅读:
    JAVA算术运算符
    java框架
    面向对象DAO模式
    JAVA JDK配置
    集合框架
    异常
    centos 部署 aspnetMVC 网页
    SQL四种语言:DDL,DML,DCL,TCL 的区别
    javascript download geoserver layer as kml file
    常用协议 —— hessian://
  • 原文地址:https://www.cnblogs.com/fjfjfjfjfjfj/p/1899152.html
Copyright © 2020-2023  润新知