The WNetConnectionDialog1 function brings up a general browsing dialog for connecting to network resources.
DWORD WNetConnectionDialog1(
LPCONNECTDLGSTRUCT lpConnectDlgStruc |
pointer to structure |
); |
If the user cancels the dialog box, the function returns 0xFFFFFFFF. If the function is successful, it returns WN_SUCCESS. Also, if the call is sucessful, dwDevNum will contain the number of the connected device.
Typically this dialog will only return an error if the user cannot enter a dialog session. This is because errors that occur after a session are reported to the user directly. Error codes include the following.
Value |
Meaning |
WN_BAD_VALUE |
One of the following: CONNDLG_RO_PATH is set and either CONNDLG_USE_MRU is set or lpConnRes->lpRemoteName does not point to a remote name. Both CONNDLG_PERSIST and CONNDLG_NOT_PERSIST are set. |
WN_BAD_DEV_TYPE |
lpConnRes->dwType is not set to RESOURCETYPE_DISK. |
WN_FUNCTION_BUSY |
The MPR or NP is busy (possibly initializing). The caller should retry. |
WN_NO_NETWORK |
The network is not present. |
WN_OUT_OF_MEMORY |
Insufficient memory to bring up the dialog. |
WN_EXTENDED_ERROR |
A network specific error occurred. Call WNetGetLastError to obtain a description of the error. |
CONNECTDLGSTRUCT, WNetConnectionDialog, WNetDisconnectDialog