WNetLogoff

This function is used to log the user off from one or all of the networks. It will not perform system logoff or unload the user's profile. The ExitWindowsEx() function must be used for system logoff.

DWORD WNetLogoff(
    LPCTSTR lpProvider,
    HWND hwndOwner
    );
 
lpProvider
Specifies the network provider for which the logoff should occur. If lpProvider is NULL, the network logoff is done to all NPs.
hwndOwner
A handle to a window which should be the owner for any messages or dialogs the network provider might display. If this parameter is NULL, the network provider may not display any UI.
WN_BAD_PROVIDER the provider name specified is invalid.
WN_NOT_LOGGED_ON the user is not logged on to this network.
WN_CANCEL the user canceled the operation.