Platform SDK: Windows Networking

WNetDisconnectDialog1

The WNetDisconnectDialog1 function attempts to disconnect a network resource. If the underlying network returns ERROR_OPEN_FILES, the function prompts the user for confirmation. If there is any error, the function informs the user. The function requires a DISCDLGSTRUCT to specify the parameters for the disconnect attempt.

DWORD WNetDisconnectDialog1(
  LPDISCDLGSTRUCT lpConnDlgStruct  // data buffer
);

Parameters

lpConnDlgStruct
[in] Pointer to a DISCDLGSTRUCT structure. The structure specifies the behavior for the disconnect attempt.

Return Values

If the function succeeds, the return value is NO_ERROR. If the user cancels the dialog box, the return value is –1.

If the function fails, the return value can be one of the following error codes.

Value Meaning
ERROR_CANCELLED When the system prompted the user for a decision about disconnecting, the user elected not to disconnect.
ERROR_OPEN_FILES Unable to disconnect because the user is actively using the connection.
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 start the dialog box.
ERROR_EXTENDED_ERROR A network-specific error occurred. Call the WNetGetLastError function to obtain a description of the error.

Requirements

  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.

See Also

Windows Networking (WNet) Overview, Windows Networking Functions, WNetConnectionDialog, WNetConnectionDialog1, DISCDLGSTRUCT, WNetDisconnectDialog