The notification process follows the same basic steps for connection and disconnection of the Windows CE–based device. The following procedure assumes that the IDccMan and IDccManSink interfaces have been implemented.
The Connection Notification Client sample application, provided on the CD-ROM that accompanies this documentation, shows several connection notification scenarios, including a new remote connect, a disconnect, and a reconnect. To see the actual sequence of interface method calls for any of these scenarios, build and run the application. Then, in the Connection Notification Test dialog box, view the Notification Messages list.
For more information on CLSID_DccMan and IID_IDccMan, see "Registering the IDccMan Class Identifiers."
The connection manager calls the IDccManSink::OnLogInactive method, notifying the application that there is no connection between the desktop computer and the device.
The connection manager waits for the remote connection services for both the desktop computer and the device to respond. Until they are both running, the connection manager will not proceed.
Note When the IDccManSink::OnLogIpAddr notification occurs, the connection is completely established.
This can include processing on the desktop computer, remote processing on the device by using remote application programming interface (RAPI), or calling the IDccMan methods. However, the application should wait to use CeRapiInit to initialize RAPI until the IDccManSink::OnLogActive notification is received. This ensures that a connection is established between the desktop computer and the device.
Windows CE Services notifies the application when the desktop computer and device are disconnected by calling the IDccManSink::OnLogDisconnection method.
Because there is no connection to the device, this processing can only take place on the desktop computer.
The Connection Notification Client source code uses the IDccMan interface and implements the IDccManSink interface.
When an application calls the IDccMan::ShowCommSettings function and the OK button is clicked in the Communications Properties dialog box, the following notification sequence occurs:
If the Cancel button is clicked instead, no notification is sent and a Listen state is maintained.
One of the advantages to using the COM interface–based notification process is that it allows an application to deregister itself from being notified. This might be helpful when an application needs to run only once.
Note that a call to CoUninitialize is required for each successful call to CoInitialize.