I am wanting to create an app that hides files/folders from windows explorer.
I think I need to create a system wide hook to do this.
Is there any vb6 sample code out there to help me with this?
thanks
Simon Canning
Printable View
I am wanting to create an app that hides files/folders from windows explorer.
I think I need to create a system wide hook to do this.
Is there any vb6 sample code out there to help me with this?
thanks
Simon Canning
To change single file attribute use SetAttr statement:
To change folder attribute it's a bit more complex and requires to use windows api.Code:Private Sub Command1_Click()
If Not Dir("c:\temp") = "" Then
SetAttr "c:\temp", vbHidden
End If
End Sub
Check out this link for a nicely wrapped sample.
Also, I'm sure you're aware that more or less advanced user can easily change those attributes to whatever they wish.
I'm sure you're aware that more or less advanced user can easily change those attributes to whatever they wish
- That is why I am interested in using a system wide hook.
What's the file system? If it is non-FAT then set the permission accordingly rather than resorting to source code which can be abused.
I agree - code can (and will) be used to produce malicious program.Quote:
Originally Posted by leinad31
Anyway, why do you need to do that?
It is ntfs.
I am wanting to hide savegame files for my game so they cannot be tampered with... Also, I would like to make a commercial app to hide files as I think it would be popular..
Using that method will only do any good if your program is running at the time (which is hard to ensure, especially if the user has a virus scanner), and is far from foolproof.
Instead of doing that kind of thing, I would advise you to take a much more popular route:
Doing that will mean a little more effort in your program to load/save the files, but it is far more reliable (and much easier to implement) than what you want to do - and also means you aren't slowing down the persons computer (or wasting the memory) by running an extra program all the time.
- Put the files into a folder that the user can't find easily - I'd recommend (as do Microsoft) using the AppData folder. You can see good example code for finding it here.
- Encrypt the file, so that even if the files are found, they can't be edited easily (if done properly, even people like us wouldn't be able to do it). You can find several examples of encryption in the CodeBank - VB6 forum.
This question has been asked many times before (even by me a few years ago) and has never been answered. Hiding files/folders in such a way that only your application can hide/show them is quite advanced stuff and probably needs a driver, something you can't write with VB6.
And why write a commercial application to hide files/folders while there are already dozens of commercial applications that can do that, like 'Hide Files & Folders', 'Hide My Folder', 'Hide Folders XP', 'File Lock', 'Folder Vault', 'VIP Defense', 'Folder Guard', 'Folder Castle', 'Masker', 'Folder Secure', 'Instant Lock', etc ?
What they often do, or have tried in the past, is to create a very large file and their driver interprets its as another file system... its not popular because when that single file gets corrupted then everything (sub files/folders) is lost. Also performance wise, such a file system would have an additional layer. Lastly, its security implementation may not comply with existing enterprise network management technologies or best practices so it may possibly end up providing less security (easier to hack) than existing counterparts tied to the OS.
Just encrypt and compress the file, or store it in a password protected database (if database supports stored procedures then do the encrypt/decrypt there).