Share via


Initialize RTC

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

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 
// Use COINIT_MULTITHREADED on Windows Embedded CE
::CoInitializeEx(NULL,COINIT_MULTITHREADED);

// 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.

See Also

Concepts

Fundamental RTC Code Examples