View Full Version : Is there a way to hide files with visual basic?
briintex1
07-22-2005, 04:32 AM
I have visual basic code that creates, reads and writes to a file. But is there a way to tell Visual basic to hide that file, in some deep dark location of a computer so not the average joe will be able to find it?
Also if I was distribute access, does a person who is recieving this file need access to actually run and use VB6.0? Or does the .EXE keep ahold of all of that?
_Aerospace_Eng_
07-22-2005, 04:49 AM
Why would this file be so important that it needs to be hidden?
briintex1
07-22-2005, 04:52 AM
People are going to write to it, and if they write to it I don't want them to accidently delete it, therefore I want to hide it.
tboss132
07-22-2005, 09:47 AM
I once was faced with the same situation. You could always hide it in the Windows System Directory. But make double sure you name it something very unique to that you don't accidently overwrite some critical Windows file with your installation.
BTW, Also make sure your application deletes the file once it's being uninstalled
Speaking from a C/C++ and WinAPI standpoint, SetFileAttributes() can be used to set the hidden attribute to a file, which will make it not visible in Explorer (unless the user set the options to view hidden files). I believe you can use this in VB as well.
oracleguy
07-22-2005, 06:35 PM
Speaking from a C/C++ and WinAPI standpoint, SetFileAttributes() can be used to set the hidden attribute to a file, which will make it not visible in Explorer (unless the user set the options to view hidden files). I believe you can use this in VB as well.
Yeah, I'm pretty sure you can do that in VB too, I mean it supports API calls too.
tboss132
07-22-2005, 06:42 PM
Is that the type of hiding he means? Sure VB can hide files. Another way is to include the hidden file in your installation program and then let your app. write to that file. That file will remain hidden when it gets to user's systems.
Imports System.IO
File.SetAttributes(PathToFile, FileAttributes.Hidden)
Is that code enough?
Any other,please ?
Thank you.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.