Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Hidden Files


Message #1 by "Philip Jack" <pkemar@c...> on Sat, 23 Nov 2002 11:54:20
> You can hide any file by changing is Hidden attribute. Just create 
a>  "Scripting.FileSystemObject" and from that a File object. Check for 
the 
H> idden attribute by a bit-wise comparison and, if not set, set it by 
a> dding 2. (The Constant vbHidden is equal to 2)

>   Dim strHiddenfile As String
 >  Dim fs As Object
 >  Dim f As Object
 >  strHiddenfile = App.Path & "\myhiddenfile.ini"  'plug your file name 
here
 >  Set fs = CreateObject("Scripting.FileSystemObject")
 >  Set f = fs.GetFile(strHiddenfile)
 >  If not(f.Attributes And vbHidden) Then
 >    f.Attributes = f.Attributes + vbHidden
 >  End If


Thanks a lot for you help i got it to work.

  Return to Index