Managing Network Connections with WNet
Use one of following functions to establish a network connection:
- WNetAddConnection3, if you know the information needed to identify the network resource.
– Or –
- WNetConnectDialog1, if you need feedback from the user. This function prompts the user to choose a local name or UNC in a dialog box.
You can terminate a connection using any of these functions:
- Use WNetCancelConnection2 to break the connection and remove the folder from the \NETWORK directory.
– Or –
- Use WNetDisconnectDialog to start a general browsing dialog box that allows the user to manage the disconnection.
– Or –
- Use WNetDisconnectDialog1 to disconnect from a network resource. If the underlying network returns WN_OPEN_FILES, the function prompts the user for confirmation. If an error occurs, it informs the user.