WNetConnectionDialog1

The WNetConnectionDialog1 function brings up a general browsing dialog for connecting to network resources.

DWORD WNetConnectionDialog1(
  LPCONNECTDLGSTRUCT lpConnectDlgStruc  pointer to structure
);
 

Parameters

lpConnectDlgStruct
Pointer to the CONNECTDLGSTRUCT structure, which establishes the browsing dialog parameters.

Return Values

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 network provider 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.

Remarks

Windows CE: Windows CE ignores the dwDevNum member of the CONNECTDLGSTRUCT structure pointed to by the lpConnectDlgStruc parameter.

In Windows CE the dwFlag parameter can be either CONNDLG_RO_PATH or 0.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Use version 2.0 or later.
  Header: Declared in winnetwk.h.
  Import Library: Use mpr.lib.

See Also

Windows Networking (WNet) Overview, Windows Networking Functions, CONNECTDLGSTRUCT, WNetConnectionDialog, WNetDisconnectDialog