Platform SDK: Windows Networking |
The WNetConnectionDialog1 function brings up a general browsing dialog for connecting to network resources. The function requires a CONNECTDLGSTRUCT to establish the dialog box parameters.
DWORD WNetConnectionDialog1( LPCONNECTDLGSTRUCT lpConnDlgStruct // data buffer );
If the user cancels the dialog box, the function returns –1. If the function is successful, it returns NO_ERROR. Also, if the call is successful, the dwDevNum member of the CONNECTDLGSTRUCT structure contains the number of the connected device.
Typically this dialog returns an error only if the user cannot enter a dialog session. This is because errors that occur after a dialog session are reported to the user directly. If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
ERROR_INVALID_PARAMETER | Both the CONNDLG_RO_PATH and the CONNDLG_USE_MRU dialog box options are set. (Dialog box options are specified by the dwFlags member of the CONNECTDLGSTRUCT structure.)
-or- Both the CONNDLG_PERSIST and the CONNDLG_NOT_PERSIST dialog box options are set. -or- The CONNDLG_RO_PATH dialog box option is set and the lpRemoteName member of the NETRESOURCE structure does not point to a remote network. (The CONNECTDLGSTRUCT structure points to a NETRESOURCE structure.) |
ERROR_BAD_DEV_TYPE | The dwType member of the NETRESOURCE structure is not set to RESOURCETYPE_DISK. |
ERROR_BUSY | The network provider is busy (possibly initializing). The caller should retry. |
ERROR_NO_NETWORK | The network is unavailable. |
ERROR_NOT_ENOUGH_MEMORY | There is insufficient memory to display the dialog box. |
ERROR_EXTENDED_ERROR | A network-specific error occurred. Call WNetGetLastError to obtain a description of the error. |
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winnetwk.h.
Library: Use Mpr.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Windows Networking (WNet) Overview, Windows Networking Functions, CONNECTDLGSTRUCT, NETRESOURCE, WNetConnectionDialog, WNetDisconnectDialog