|
|
Title | List the places in the network neighborhood in Visual Basic 6 |
Description | This example shows how to list the places in the network neighborhood in Visual Basic . |
Keywords | network, network neighborhood, Visual Basic |
Categories | Files and Directories, Internet |
|
|
Note: Add a reference to the COM object "Windows Script Host Object Model."
The program creates a WScript.Shell object and uses its SpecialFolders property to find the NetHood special folder. It then uses Dir to loop through the subdirectories it contains displaying their names.
|
|
Private Sub Form_Load()
Dim wsh_shell As IWshShell3
Dim special_folders As WshCollection
Dim nethood_path As String
Dim file_name As String
' Make a Windows Script Host Shell object.
Set wsh_shell = CreateObject("WScript.Shell")
' Find the Nethood folder.
Set special_folders = wsh_shell.SpecialFolders
nethood_path = special_folders.Item("Nethood")
' Enumerate the subdirectories in Nethood.
file_name = Dir$(nethood_path & "\*", vbDirectory)
Do While Len(file_name) > 0
lstLinks.AddItem file_name
file_name = Dir$()
Loop
End Sub
|
|
|
|
|
|