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.
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.
Quick practical summary and caution for : 's folder-attribute approach will hide a folder from normal Explorer view, and the registry "NoDrives" trick (the same setting exposed by the Group Policy "Hide these specified drives in My Computer") hides drive icons/letters in Explorer — but both are UI-level only. Hidden drives/folders remain addressable by path (Start->Run, cmd, other apps) and Explorer-level hiding does not equal access control. (learn.microsoft.com)
If the goal is "quick hide/unhide" without touching VB code, use the shell attrib command for a folder and restart Explorer to apply drive-mask changes without a full logoff:
attrib +h +s "D:\test" # hide folder (hidden + system)
attrib -h -s "D:\test" # unhide folder
taskkill /f /im explorer.exe
start explorer.exe Changing the NoDrives registry value normally needs a logoff/restart for Explorer to apply it; restarting Explorer.exe is a common shortcut to avoid a full reboot. Back up the registry before editing. (support.microsoft.com)
Important security notes (why saw search results): Finder/indexing can still reveal hidden items unless you exclude them from indexing or disable “include non‑indexed, hidden and system files” in advanced search options. Hiding is not a security control — use NTFS permissions to deny list/read, or encrypt the volume (BitLocker or equivalent) if you need real protection. For sensitive data, prefer permission changes or full-disk/volume encryption over relying on attributes or NoDrives. (learn.microsoft.com)
Jump to Post— Sawamura 9Using Api function to hide drive
Jump to Post— Jx_Man 987try 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 Subto unhide set attributes = 0
Jump to Post— Jx_Man 987>>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 …
Do you use any control or what?
Where will other drives or folders be shown?
Little info little help. :P
>> 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...
Using Api function to hide drive
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
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...
>>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
....
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.
its all i know...
maybe other members have different ways
how i unhide my drive. now my drive d is hide. so please help me
use 0 for unhide
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.