惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
N
Netflix TechBlog - Medium
C
Check Point Blog
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
I
InfoQ
Hugging Face - Blog
Hugging Face - Blog
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
腾讯CDC
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
V
V2EX
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
U
Unit 42
B
Blog

博客园 - 撬棍

【.Net】2、8、16进制转换 【.Net】执行CMD命令 【.Net】获取随机数函数 【.Net】注册程序开机启动 【.Net】把窗体“钉”到桌面上 【.Net】多语言查看MSDN 【.Net】 显示星期字符串 【.Net】 判断时间字符串正确性 【.Net】 实现窗口拖动 【.Net】 Winform 单例运行实例 [C++]函数返回值 [C++]数组参数 [C++]const的指针使用 [C++]指针类型出参 [VBA]Excel输出utf-8编码格式文件 使用WideCharToMultiByte 【C++】split [C语言学习]之打印万年历 - 撬棍 - 博客园 [VB6.0]让程序在任务列表和资源管理器“隐身” [VB]修改注册表让程序开机自动运行 - 撬棍 - 博客园
[InstallShield]FindAllFiles与SetFileInfo配合实现文件加多...
撬棍 · 2010-12-07 · via 博客园 - 撬棍

很荣幸,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测试通过!