Add a Participant to an Existing Session
The following code example demonstrates how to add a participant to an existing MIM session. The operations in the Initialize RTC and Create a Multiparty IM Session and Add a Participant code examples must be performed before using this example.
Note This example does not contain error checking or releases appropriate for real code.
C++ Code Example
IRTCParticipant *pIRTCParty = NULL; BSTR bstrDestURI = SysAllocString(L"someone2@microsoft.com"); // Add the participant. hr = pIRTCSession->AddParticipant(bstrDestURI, NULL, &pParty); // If (hr != S_OK), process the error here. // Wait for the RTCE_PARTICIPANT_STATE_CHANGE event of // type RTCPS_CONNECTED, indicating that the participant // has successfully joined the session.
Visual Basic Code Example
Dim objSession As IRTCSession Dim objParticipant As IRTCParticipant Dim strDestURI As String '(for example, someone2@microsoft.com) Dim strDestName As String '(for example, Jeff Smith) 'Add a participant to the IM session. Set objParticipant = objSession.AddParticipant(strDestURI, _ strDestName) ' If (Err.Number), process the error here. ' Wait for the RTCE_PARTICIPANT_STATE_CHANGE event of ' type RTCPS_CONNECTED, indicating that the participant ' has been successfully added to the session.