Initialize the Communications Service

The following code example shows how to create and initialize the RTC client object.

**Note   **This code has not been thoroughly tested, does not contain error checking, and is not intended for production use.

HRESULT hr = S_OK;
// RTC Initialization 
// Note: Use the apartment threaded model because
// RTC applications are not thread safe.
::CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
// Create the RTC Client COM object. 
IRTCClient *pIRTCClient;
hr = CoCreateInstance( CLSID_RTCClient,
                       NULL,
                       CLSCTX_INPROC_SERVER,
                       IID_IRTCClient,
                       reinterpret_cast<void **> (&pIRTCClient) );
// if (hr != S_OK) process error here. 
// Initialize the RTCClient interface. 
hr = pIRTCClient->Initialize();
// if (hr != S_OK) process error here.

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.