Initialize RTC (Windows Embedded CE 6.0)
1/6/2010
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.