我想让一个文件夹在windows资源管理器里不可见,或者不可访问,但是在程序中可以读取其中的文件,请高手指教我该怎么办?

解决方案 »

  1.   

    dir就可以
    DirName = Dir(path, vbDirectory Or vbHidden Or vbArchive Or vbReadOnly _
    Or vbSystem)  ' Even if hidden, and so on.
          Do While Len(DirName) > 0
             ' Ignore the current and encompassing directories.
             If (DirName <> ".") And (DirName <> "..") Then
                ' Check for directory with bitwise comparison.
                If GetAttr(path & DirName) And vbDirectory Then
                   dirNames(nDir) = DirName
                   DirCount = DirCount + 1
                   nDir = nDir + 1
                   ReDim Preserve dirNames(nDir)
                   'List2.AddItem path & DirName ' Uncomment to list
                End If                           ' directories.
       sysFileERRCont:
             End If
             DirName = Dir()  ' Get next subdirectory.
          Loop
      

  2.   

    这是改文件属性的,具体怎么自己想吧!
    n = GetAttr("d:\a.txt")
    '修改文件属性
    SetAttr "d:\a.txt", vbNormal
    ............
    '恢复文件属性
    SetAttr "d:\a.txt", n