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.


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


[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
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
A network-specific error occurred. To obtain a description of the error, call the WNetGetLastError function.
The network is unavailable.
There is insufficient memory to start the dialog box.


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.


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





Windows Networking (WNet) Overview

Windows Networking Functions