windows - Win - 你能一步创建一个隐藏文件夹吗?

标签 windows winapi visual-c++ ntfs

据我所知,创建隐藏文件夹的方法是:

创建目录(文件夹名称); SetFileAttributes( 文件夹名称, FILE_ATTRIBUTE_HIDDEN );

这样做会导致目录暂时存在,而不是隐藏的。云软件和备份等其他程序可能会错误地将其视为非隐藏...并对其进行处理。

是否可以在单个 API 调用中实现相同的目的?一个原子步骤?好像应该可以吧! ??

最佳答案

您可以使用 CreateDirectoryEx为了这。

Creates a new directory with the attributes of a specified template directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory. The new directory retains the other attributes of the specified template directory.

您需要一个具有合适(即隐藏)属性的模板目录。

关于windows - Win - 你能一步创建一个隐藏文件夹吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21640193/

相关文章:

c++ - 拦截WinAPI调用并修改返回值

c++ - 从函数指针创建 boost::function 的跨平台方式

c++ - 为什么 al_draw_textf() 打印数字而不是存储在字符串变量中的字母?

r - 已知在 windows xp 上运行的最新版本的 R 是什么?

windows - 有没有办法跟踪来自 TComboBox 的滚动条消息?

c - 在 Windows 中检测 VPN 连接?

c# 移动 Winamp 主窗口

visual-c++ - VC++ .Net Clr/Safe 和 Clr/Pure

windows - 如何将多个 *.zip 存档文件解压缩到单独的文件夹中?

c++ - 如何创建 std::string 包装器,将 ptr 保留到 std::string 并将 ptr 保留到创建该包装器实例的类中的特殊类函数?