Logging Off With Roaming

The following code example demonstrates how to log off from the server and terminate all roaming sessions. The operations in the Initialize RTC and Logging On With Roaming code examples must be performed before using this example.

Note  This code example does not contain error checking or releases appropriate for real code.

C++ Code Example

HRESULT                 hr = S_OK;
IRTCClientProvisioning  *pProv = NULL;
IRTCProfile             *pProfile = NULL;
IRTCClientPresence2     *pPresence2 = NULL;


// Query for IRTCClientProvisioning and  
// IRTCClientPresence2 from the IRTCClient object.
// Get the profile from a member/global variable or
// travers through the list of profiles to get it.

// Disable the profile
hr = pProv->DisableProfile(pProfile);

// if (hr != S_OK) process error here 

// Disable presence
hr = pPresence2->DisablePresence();

// if (hr != S_OK) process error here 

// This will log you off from the server and also terminate
// terminate all the roaming sessions.
// You need to wait for the RTCE_REGISTRATION_STATE_CHANGE event 
// of type RTCRS_NOT_REGISTERED 

Visual Basic Code Example

Dim objProv As IRTCClientProvisioning
Dim objProfile As IRTCProfile
Dim objPresence2 As IRTCClientPresence2

' Get objProv and objProfile from the IRTCClient object
' Get the profile from a member/global variable or 
' traverse the list of profiles and get it.

' Disable the profile
objProv.DisableProfile objProfile

' if (Err.Number) process error here

' Disable presence
objPresence2.DisablePresence

' if (Err.Number) process error here

' This will log you off from the server and also 
' all the roaming sessions.
' The application will need to wait for the 
' RTCE_REGISTRATION_STATE_CHANGE event of type 
' RTCRS_NOT_REGISTERED