Platform SDK: Windows Networking |
The WNetConnectionDialog function starts a general browsing dialog box for connecting to network resources. The function requires a handle to the owner window for the dialog box.
DWORD WNetConnectionDialog( HWND hwnd, // handle to window owning dialog box DWORD dwType // resource type );
Value | Meaning |
---|---|
RESOURCETYPE_DISK | Connections to disk resources. |
If the function succeeds, the return value is NO_ERROR. If the user cancels the dialog box, the function returns –1.
If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
ERROR_EXTENDED_ERROR | A network-specific error occurred. To obtain a description of the error, call the WNetGetLastError function. |
ERROR_INVALID_PASSWORD | The specified password is invalid. |
ERROR_NO_NETWORK | The network is unavailable. |
ERROR_NOT_ENOUGH_MEMORY | There is insufficient memory to start the dialog box. |
If the user clicks OK in the dialog box, the requested network connection will have been made when the WNetConnectionDialog function returns.
If the function attempts to make a connection and the network provider returns the message ERROR_INVALID_PASSWORD, the system prompts the user to enter a password. The system uses the new password in another attempt to make the connection.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winnetwk.h.
Library: Use Mpr.lib.
Windows Networking (WNet) Overview, Windows Networking Functions, WNetAddConnection3, WNetCancelConnection2, WNetDisconnectDialog