zoukankan      html  css  js  c++  java
  • [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测试通过!

  • 相关阅读:
    达梦数据库配置信息
    linux命令收集
    达梦数据库快速学习上手教程
    linux命令收集
    关于deciaml的类型转换问题
    exjs 导出excel
    Win7 系统IIS的配置方法 及相关参数设置
    为MFC添加UAC控制 (UAC Execution Level)
    asp.net 六大内置对象(1)
    .NET Framework 的垃圾回收器管理应用程序的内存分配和释放
  • 原文地址:https://www.cnblogs.com/fjfjfjfjfjfj/p/1899152.html
Copyright © 2011-2022 走看看