954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Hide Folder / Drive

Hi Masters...
I want to hide folder or drive with vb6, but i don't have idea how to do this.
any one know how to solved this?

Please Help.
Any suggestion will appreciated much.

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

Do you use any control or what?

Where will other drives or folders be shown?

Little info little help. :P

Teropod
Light Poster
36 posts since Jul 2008
Reputation Points: 10
Solved Threads: 6
 

>> Do you use any control or what?
No, i don't.
I just wanna to hide or unhide drive or folder.
Ex : D:\test (Hide folder test on drive D)...
Any suggestion...

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

Using Api function to hide drive

Sawamura
Junior Poster in Training
69 posts since Nov 2007
Reputation Points: 55
Solved Threads: 6
 

try this following code to hide folder

Private Sub Form_Load()
Dim FileSys, FolderPath
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set FolderPath = FileSys.GetFolder("D:\test")
FolderPath.Attributes = -1
End Sub

to unhide set attributes = 0

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Thx Jx_man, your code worked nice.
one problem again, how to hide drive?
there are another ways to hide drive without using API function?

Any suggestion...

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

>>There are another ways to hide drive without using API function?
Yes, with add key on your registry...
Add module :

Public Sub CreateKey(ayun As String, Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite ayun, Value
End Sub

Public Sub CreateIntegerKey(ayun As String, Value As Integer)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite ayun, Value, "REG_DWORD"

End Sub
'Delete registry key
Public Sub DeleteKey(Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub

This following code will hide drive D:\

Private Sub Command1_Click()
CreateIntegerKey "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Nodrives", 8
End Sub

Restart or logoff to know it works or not
This is value of key :
C = 4
D = 8
E = 16
F = 32
...
C and D = 4 + 8 = 12
C and E = 4 + 16 = 20
D and E = 8 + 16 = 24
....
C and D and E = 4 + 8 + 16 = 28
....

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

wow, thank you Jx_Man.
It worked, but i must logoff or restart to see the result of hiding drive.

There are anyone know another way to hide without logoff or restart computer.

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

its all i know...
maybe other members have different ways

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

how i unhide my drive. now my drive d is hide. so please help me

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

use 0 for unhide

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

Private Sub Command1_Click()
Dim FileSys, FolderPath
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set FolderPath = FileSys.GetFolder("E:\Locked")

FolderPath.Attributes = -1
End Sub

Private Sub Command2_Click()
Dim FileSys, FolderPath
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set FolderPath = FileSys.GetFolder("E:\Locked")
FolderPath.Attributes = -0
End Sub

Great Poject but still finds hidden folder if searched for.

Lesbassnett
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You