WNetConnectionDialog

  DWORD WNetConnectionDialog(hwnd, fdwResourceType)    
  HWND hwnd; /* handle of window owning dialog box */
  DWORD fdwResourceType; /* resource type to allow connections to */

The WNetConnectionDialog function starts a general browsing dialog box for connecting to and disconnecting from network resources.

Parameters

hwnd

Specifies the handle of the owning window.

fdwResourceType

Specifies the resource type to allow connections to. This parameter may be may be one of the following values:

Value Meaning

RESOURCETYPE_DISK  
  Connect to disk resources.
RESOURCETYPE_PRINT  
  Connect to print resources.

Return Value

If the function is successful, the return value is NO_ERROR. Otherwise, it is an error code, which may be one of the following:

Value Meaning

ERROR_EXTENDED_ERROR A network-specific error occurred. Use the WNetGetLastError function to obtain a description of the error.
ERROR_INVALID_PASSWORD The specified password is invalid.
ERROR_NO_NETWORK No network is present.
ERROR_NOT_ENOUGH_MEMORY There is insufficient memory to start the dialog box.

This function returns error codes for compatibility with Windows 3.1. For compatibility with Win32, the function also sets the error-code value returned by the GetLastError function.

Comments

If the user chooses OK in the dialog box, the requested network connections or disconnections will have been performed when this function returns.

If the function attempts to make a connection and the provider returns ERROR_INVALID_PASSWORD, Windows prompts the user to enter a password and uses the new password in another attempt to make the connection.

See Also

WNetAddConnection2, WNetCancelConnection2