隐藏路径程序中的文件 [英] Hide files in path programm

查看:86
本文介绍了隐藏路径程序中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我用Visual Basic 6.0编写程序

将所有文件夹隐藏在程序路径(app.path)

但仅隐藏包含文件 的文件夹,并且不隐藏任何文件

现在,我想知道什么隐藏程序路径中的所有文件和文件夹?

Hi
i write a program with visual basic 6.0

that the hide all folder at program path(app.path)

but only hide folders that contain file and don''t hide any file

now , i want know that what be hide all of file and folder in program path????

the source:
Dim fso As New FileSystemObject

Public Sub allfilelock(path As String)
Dim f As Folder, fc As Folders, f1 As Folder
Dim fil As Files
Set f = fso.GetFolder(path)
Set fc = f.SubFolders
If fc.Count = 0 Then
Exit Sub
End If
For Each f1 In fc
        Set fil = f1.Files
        If fil.Count <> 0 Then
       SetAttr f1.path, vbHidden  + vbSystem
       
        End If

allfilelock (f1.path)
Next
End Sub

Public Sub allfileshow(path As String)
Dim f As Folder, fc As Folders, f1 As Folder
Dim fil As Files
Set f = fso.GetFolder(path)
Set fc = f.SubFolders
If fc.Count = 0 Then
Exit Sub
End If
For Each f1 In fc
        Set fil = f1.Files
        If fil.Count <> 0 Then
     SetAttr f1.path, vbArchive
        End If

allfilelock (f1.path)
Next
End Sub

Private Sub Form_Load()
On Error GoTo errhandler
errhandler:
Select Case Err.Number
Case 53:
MsgBox (" File For Hidden Not Found ")
Exit Sub
End Select

End Sub

Private Sub LHCommand1_Click()
allfilelock App.path
End Sub

Private Sub LHCommand2_Click()
allfileshow App.path
End Sub

推荐答案

这不起作用,任何人都可以设置Windows显示隐藏文件.为什么使用VB6?为什么不学习真正的,现代的,支持的语言?但是,文件可以标记为隐藏,所以我想您做得不好.
This won''t work, anyone can set up Windows to show hidden files. Why are you using VB6 ? Why not learn a real, modern, supported language ? However, files CAN be marked as hidden, so I guess you''re not doing it right.


这篇关于隐藏路径程序中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆