WNetDisconnectDialog function (winnetwk.h)

The WNetDisconnectDialog function starts a general browsing dialog box for disconnecting from network resources. The function requires a handle to the owner window for the dialog box.

Syntax

DWORD WNetDisconnectDialog(
  [in] HWND  hwnd,
  [in] DWORD dwType
);

Parameters

[in] hwnd

Handle to the owner window for the dialog box.

[in] dwType

Resource type to disconnect from. This parameter can have the following value.

Value Meaning
RESOURCETYPE_DISK
Disconnects from disk resources.

Return value

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 is a system error code, such as one of the following values.

Return code Description
ERROR_EXTENDED_ERROR
A network-specific error occurred. To obtain a description of the error, call the WNetGetLastError function.
ERROR_NO_NETWORK
The network is unavailable.
ERROR_NOT_ENOUGH_MEMORY
There is insufficient memory to start the dialog box.

Remarks

The WNetDisconnectDialog function returns immediately and creates a dialog box for disconnecting networked drives. This dialog box runs asynchronously on a worker thread.

If the worker thread is terminated, the owner window and its associated dialog box are also terminated. If this occurs, the user might not be able to interact with the dialog box, because it will not appear on the user's screen or will appear briefly.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winnetwk.h
Library Mpr.lib
DLL Mpr.dll

See also

WNetAddConnection2

WNetCancelConnection2

WNetConnectionDialog

WNetConnectionDialog1

Windows Networking (WNet) Overview

Windows Networking Functions