2 clicks west of a Quirkafleeg...Cornwall, England
Posts
754
I'll give you the code for this tomorrow, what happens is that there is a hidden listview, and a LVM_SETITEMSTATE message gets sent, same as a treeview....I'm 80% thru the code, you'll have it tomorrow, as for the find dialog hack with the findwindow e.t.c it WORKED A TREAT, I was pretty chuffed too, here it is - have fun (I know it's not the best way to do it, but it works)
you can do it via DOS. i don't know if that's what those examples show but you run this:
Shell("C:\windows\command\attrib.exe +h C:\filename.dat")
that will make it 'ghosted', if you replace it with a -h it unghosts it.
You could use simple VBScript to do it for you.
You just change the Attributes property of the File Object.
Here is an example of a helpful sub that will change the attributes of a file for you:
Private Sub ChangeFileAttributes(Path As String, ReadOnly _
As Boolean, Hidden As Boolean, Archive As Boolean)
Dim FSO As Object
Dim objFile As Object
Dim AttrVal As Integer
Const intReadOnly = 1
Const intHidden = 2
Const intArchive = 32
'Calculate Attribute Number
If ReadOnly = True Then AttrVal = intReadOnly
If Hidden = True Then AttrVal = AttrVal + intHidden
If Archive = True Then AttrVal = AttrVal + intArchive
'Set Attributes
On Error GoTo FileError
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objFile = FSO.GetFile(Path)
objFile.Attributes = AttrVal
Exit Sub
FileError:
'If error occured show msgbox
MsgBox "An error occured, file may not exists."
End Sub