This function brings up a general browsing dialog for connecting to network resources.
DWORD WNetConnectionDialog1 (
LPCONNECTDLGSTRUCT lpConnectDlgStruct
);
typedef struct {
DWORD cbStructure;
HWND hwndOwner;
LPNETRESOURCE lpConnRes;
DWORD dwFlags;
DWORD dwDevNum;
} CONNECTDLGSTRUCT, FAR *LPCONNECTDLGSTRUCT;
RESOURCETYPE_DISK | Connect to disk resources. |
RESOURCETYPE_PRINT | Connect to print resources. |
CONNDLG_RO_PATH | Instead of allowing user to type in flag, have a read only path already inserted. This flag should only be set if lpConnRes.lpRemoteName is not NULL (or an empty string), and CONNDLG_USE_MRU is not set. |
CONNDLG_CONN_POINT | Internal flag. Do not use. |
CONNDLG_USE_MRU | Fill up the combobox, listing most recently used paths. |
CONNDLG_HIDE_BOX | Show the checkbox allowing the user to select whether or not the connection should be restored 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. |
If neither CONNDLG_RO_PATH or CONNDLG_USE_MRU is set in dwFlags, then the request defaults to CONNDLG_RO_PATH if lpConnRes.lpRemoteName does not specify a remote path and 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.
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 either RESOURCETYPE_DISK or RESOURCETYPE_PRINT. |
WN_FUNCTION_BUSY | The MPR or NP is busy (possibly initializing). The caller should retry. |
WN_NO_NETWORK | network is not present. |
WN_OUT_OF_MEMORY | insufficient memory to bring up the dialog. |
WN_EXTENDED_ERROR | a network specific error occurred. WNetGetLastError should be called to obtain a description of the error. |
NETRESOURCE