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
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.
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
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.Originally Posted by leinad31
Anyway, why do you need to do that?
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
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.
(2007, 2008, 2009, 2010, 2011, 2012) . . . . . . . . Hitchhiker's Guide to Getting Help at VBForums
Classic VB FAQs (updated Oct 2010) ...Database Development FAQs/Tutorials (updated May 2011)
(includes fixing common VB errors) .......... (includes fixing common DB related errors, and [Classic VB] ADO tutorial /further steps, and [VB.Net] ADO.Net Tutorial).
Tutorial: How to automate Excel from VB6 (or VB5/VBA) .. SQL 'Select' statement formatter/checker .. Convert colour number to colour name .. FlexGrid: fill from recordset .. FlexGrid: AutoSize columns .. DB Reserved Words checker
Connection strings .. MDAC/Jet/ACE downloads .. SQL Server downloads .. MZTools (free upgrade for the VB6/VBA Editor)
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).