Using the Connections Dialog Box

Windows NT Only

The WNetConnectionDialog function creates a dialog box that allows the user to browse and connect to network resources. Conversely, the WNetDisconnectDialog function creates a dialog box that allows the user to disconnect from network resources.

The following example shows how to use the WNetConnectionDialog function to create a dialog box that displays disk resources.

DWORD dwResult; 

dwResult = WNetConnectionDialog(hwnd, RESOURCETYPE_DISK);

if(dwResult != NO_ERROR) 
{
    // An application-defined error handler is demonstrated in the 
    // section titled "Retrieving Network Errors." 

    NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetConnectionDialog"); 
    return FALSE; 
}