1

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.

6
Contributors
11
Replies
14
Views
8 Years
Discussion Span
Last Post by Lesbassnett
Featured Replies
  • Using Api function to hide drive Read More

  • 1

    try this following code to hide folder [code=vb]Private Sub Form_Load() Dim FileSys, FolderPath Set FileSys = CreateObject("Scripting.FileSystemObject") Set FolderPath = FileSys.GetFolder("D:\test") FolderPath.Attributes = -1 End Sub [/code] to unhide set attributes = 0 Read More

  • 2

    >>There are another ways to hide drive without using API function? Yes, with add key on your registry... Add module : [code=vb]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 … Read More

0

Do you use any control or what?

Where will other drives or folders be shown?

Little info little help. :P

0

>> 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...

1

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

Votes + Comments
Wonderful code
0

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...

2

>>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
....

Votes + Comments
Really Great code
0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.