Shut Down RTC (Windows CE 5.0)
The following code example shows how to shut down the RTC client. The operations in the Initialize RTC example must be performed before using this code.
**Note **This code has not been thoroughly tested, does not contain error checking, and is not intended for production use.
HRESULT hr = S_OK;
// Asynchronously prepare the client object for
// shutting down. No new sessions can be initiated
// after calling this method. For UI-based applications
// it is recommended that applications call
// IRTCClient::PrepareForShutdown first and then
// hide the UI window until the RTCCET_ASYNC_CLEANUP_DONE
// event is fired and the UI-Window is destroyed.
hr = pIRTCClient->PrepareForShutdown();
// if (hr != S_OK) process error here
// The call to PrepareForShutdown will fire
// an RTC_CLIENT event of type RTCCET_ASYNC_CLEANUP_DONE.
// In the RTC_CLIENT IRTCClientEvent handler method, call shutdown
// on the client and release the client object after receiving this
// event.
// ....
// In the RTC_CLIENT event handler
IRTCClientEvent *pIClientEvent = NULL;
RTC_CLIENT_EVENT_TYPE EventType;
// Get the client event interface.
hr = pIDispatch->QueryInterface(IID_IRTCClientEvent,
reinterpret_cast<void**> (&pIClientEvent));
// if (hr != S_OK) process error here
hr = pIClientEvent->get_EventType(&EventType);
// if (hr != S_OK) process error here
switch(EventType)
{
// Handle the case for completion of the
// PrepareForShutdown method.
case RTCCET_ASYNC_CLEANUP_DONE :
{
// This method cleans up the client object and
// must be called before releasing the object.
hr = pIRTCClient->Shutdown();
// if (hr != S_OK) process error here
pIRTCClient->Release();
pIRTCClient = NULL;
break;
}
// .....
}
See Also
Send Feedback on this topic to the authors