How To List Local Network Connections with WNetEnumResources (177697)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition for Windows 4.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- the operating system: Microsoft Windows NT 3.51
- the operating system: Microsoft Windows NT 4.0
- the operating system: Microsoft Windows 95
- Microsoft Platform Software Development Kit (SDK) 1.0
- the operating system: Microsoft Windows 2000
- the operating system: Microsoft Windows Millennium Edition
This article was previously published under Q177697 SUMMARY
WNetOpenEnum and WNetEnumResources can be used to list the local drives,
printer ports that have been redirected, and any UNC connections on a
machine running Windows 2000, Windows NT, Windows Me, Windows 98, or Windows 95.
The code below demonstrates how to do this from Visual Basic by first
calling WNetOpenEnum with the dwType parameter set to RESOURCETYPE_ANY. A
valid handle returned via the last parameter is passed to
WNetEnumResources. This function fills a temporary buffer with an array of
NETRESOURCE structures, which includes information about the local network
connections.
Note that this functionality will not list the resources that are
redirected on a remote machine. No such functionality exists in either
operating system.
Modification Type: | Minor | Last Reviewed: | 7/11/2005 |
---|
Keywords: | kbhowto kbWNet KB177697 |
---|
|