SetFileAttributes 设置属性

 1 #include <Windows.h>
 2 #include <tchar.h>
 3 
 4 int WINAPI _tWinMain(HINSTANCE hInstance,
 5                      HINSTANCE hPrevInstance,
 6                      LPTSTR lpCmdLine,
 7                      int nCmdShow) 
 8 {
 9     SetFileAttributes(_T("D:\\文件路径.txt"),FILE_ATTRIBUTE_HIDDEN);
10     
11     SetFileAttributes(_T("D:\\文件路径.txt"),FILE_ATTRIBUTE_READONLY);//设为只读
12     SetFileAttributes(_T("D:\\文件路径.txt"),FILE_ATTRIBUTE_HIDDEN);//设为隐藏
13     SetFileAttributes(_T("D:\\文件路径.txt"),FILE_ATTRIBUTE_NORMAL);//设为正常,取消全部属性设定
14 
15     //参数1:要设置属性的文件的完整路径
16     //参数2:要设置何种文件属性,只读、隐藏等15种权限
17 
18     return 0;
19 }
相关文章
相关标签/搜索