16.1.1 Network-Independent Functions

Windows version 3.1 included several 32-bit network-independent networking functions: WNetAddConnection, WNetCancelConnection, and WNetGetConnection. Win32 includes these functions and adds the following new networking functions: WNetAddConnection2, WNetCancelConnection2, WNetConnectionDialog, WNetGetUser, WNetGetLastError, and three network-enumeration functions, WNetOpenEnum, WNetEnumResource, and WNetCloseEnum. Many of these functions use a NETRESOURCE structure, which also is new for Win32.

An application can use the network functions to browse and add or cancel network connections anywhere in the hierarchy. By starting at the network root, the resources from all network providers can be enumerated.

The WNetAddConnection2 and WNetCancelConnection2 functions allow an application to control whether a network connection is persistent from one session to the next. When a network connection is persistent, Windows automatically restores the connection when the user logs on.