WNetLogon

This function is used to log the user on to one or all of the networks.

DWORD WNetLogon(
    LPCTSTR lpProvider,
    HWND hwndOwner
    );
 
lpProvider
Specifies the network provider for which the logon should occur. If lpProvider is NULL, the network logon is done to all NPs, even if system logon has already been performed.
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_CANCEL the user canceled the operation.