Prev Next

CONNECTDLGSTRUCT info  Overview  Group

The CONNECTDLGSTRUCT data structure is used in the WNetConnectionDialog1 function to specify the browsing dialog box parameters.

typedef struct {

    DWORD cbStructure;

    HWND hwndOwner;

    LPNETRESOURCE lpConnRes;

    DWORD dwFlags;

    DWORD dwDevNum;

} CONNECTDLGSTRUCT, *LPCONNECTDLGSTRUCT;

Members

cbStructure
Specifies, in bytes, the size of this structure.
hwndOwner
Specifies the handle of the owning window.
lpConnRes
If lpRemoteName is specified, this member will be entered into the path field of the dialog box. All other members must be set to NULL except dwType which specifies the type of resources of interest, and must be one of RESOURCETYPE_DISK.
Windows NT: Windows NT does not support the RESOURCETYPE_PRINT flag for browsing and connecting to print resources.
dwFlags
Specifies variations in the dialog display. To simulate WNetConnectionDialog, set this member to CONNDLG_USE_MRU. Currently, this may be a combination of the following values.

Value

Meaning

SidTypeUser

The account is a user account.

CONNDLG_RO_PATH

Instead of allowing the user to type in a path, have a read-only path already inserted. This flag should be set only if lpRemoteName is not NULL (or an empty string), and CONNDLG_USE_MRU is not set.

CONNDLG_CONN_POINT

Internal flag. Do not use.
Windows NT: Windows NT does not support the CONNDLG_CONN_POINT flag.

CONNDLG_USE_MRU

Enter the most recently used paths into the combo box.

CONNDLG_HIDE_BOX

Show the check box allowing the user to restore the connection at logon.

CONNDLG_PERSIST

Set if the connection is to be restored at logon.

CONNDLG_NOT_PERSIST

Set if the connection is not to be restored at logon.

dwDevNum
If the call is successful, this member returns the number of the device connected to. The value is 1 for A:, 2 for B:, 3 for C:, and so on. If the user made a deviceless connection, the value is 0xFFFFFFFF.

Return Values

The function returns WN_SUCCESS if the call is successful and brings up the dialog. Typically this function will return an error only if the dialog box could not be displayed because errors that occur thereafter are reported to the user directly. If the call is successful, dwDevNum contains the number of the device connected to. If the user cancels the dialog box, the function returns 0xFFFFFFFF.

Error codes include one of the following.

Value

Meaning

WN_BAD_VALUE

One of two meanings:

  1. CONNDLG_RO_PATH is set and either CONNDLG_USE_MRU is set or lpRemoteName does not point to a remote name.

  2. Both CONNDLG_PERSIST and CONNDLG_NOT_PERSIST are set.

Remarks

If neither CONNDLG_RO_PATH nor CONNDLG_USE_MRU is set in dwFlags, then the request defaults to CONNDLG_RO_PATH if lpRemoteName does not specify a remote path to CONNDLG_USE_MRU. Otherwise, CONNDLG_PERSIST and CONNDLG_NOT_PERSIST cannot both be set. If neither is set, then the dialog defaults to the last option that was selected on this dialog for the particular type of device being connected.

See Also

WNetConnectionDialog1