Shutting Down an Address Book Provider

Shutting Down an Address Book Provider

After you finish using an address book provider, you must properly log off and shut down the address book provider. For more information on using the address book provider, see Accessing an Address Book Provider.

To log off the address book provider, you must call the IABLogon::Logoff function to unsubscribe from notifications the address book provider registered to receive. Finally, the IABProvider::Shutdown function is called to shut down the address book provider.

In this topic, these functions are demonstrated by using code examples from the Sample Address Book Provider. The Sample Address Book Provider implements the required features of an address book provider, as well as more advanced features such as name resolution. For more information about the required features of an address book provider, see Required Features for Address Book Providers. For more information about downloading and installing the Sample Address Book Provider, see Installing the Sample Address Book Provider.

Logoff Routine

The IABLogon::Logoff function unsubscribes the address book provider from registered notifications by calling the Unsubscribe function.

CABLogon::Logoff() Example

  STDMETHODIMP CABLogon::Logoff(ULONG /* ulFlags */)
{
    // Unsubscibe from registered notifications
    for (list<ULONG>::iterator it = m_ullstAdviseCnx.begin();
        it != m_ullstAdviseCnx.end(); it++)
    {
        m_pSupObj -> Unsubscribe(*it);
    }
    return S_OK;
}

Shut Down Routine

The final step in shutting down an address book provider is to call the IABProvider::Shutdown function. IABProvider::Shutdown terminates all sessions associated with this address book provider.

CABProvider::Shutdown() Example

  STDMETHODIMP CABProvider::Shutdown(ULONG * /* lpulFlags */)
{
    return S_OK;
}

See Also

About the Sample Address Book Provider

Installing the Sample Address Book Provider

Initializing an Address Book Provider

Accessing an Address Book Provider

Using an Address Book Container