Notification and Unregistration Procedures

The notification process follows the same basic steps for connection and disconnection of the Windows CE-based device. The following outline assumes that the IDccMan and IDccManSink interfaces have been implemented.

  1. Initialize the COM library and register the application for the appropriate event.
  2. Connect or disconnect the Windows CE-based device.
  3. Perform the application processing.

The Connection Notification Client sample program 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 program. Then, view the Notification Messages list box output in the Connection Notification Test dialog box. For a description of this sample, see Windows CE Sample Applications.

    To receive notification when the Windows CE-based device connects to a desktop computer
  1. Initialize the COM library and register with the Windows CE Services connection manager.
    1. Call the COM function CoInitialize to initialize the Component Object library.
    2. Call the COM function CoCreateInstance with the DccMan class identifier (CLSID_DccMan) and IDccMan interface identifier (IID_IDccMan) and receive a pointer to the IDccMan interface. For more information on CLSID_DccMan and IID_IDccMan, see Registering the IDccMan Class Identifier.
    3. Call the IDccMan::Advise method, which provides the connection manager with a pointer to the IDccManSink interface that you implemented. It also registers the application with the connection manager.
    4. The Windows CE Services connection manager calls the IDccManSink::OnLogInactive method, notifying the application that there is no connection between the desktop computer and the mobile device.
  2. Establish the connection between the desktop and the mobile device.
    1. The Windows CE Services connection manager calls the IDccManSink::OnLogListen method. Then, it waits for the remote connection services for both the desktop computer and the Windows CE-based device to respond. Until they are both running, the connection manager will not proceed.
    2. For Windows 95-based systems only, the connection manager calls the IDccManSink::OnLogAnswered method when the connection manager has detected the communications interface.
    3. The Windows CE Services connection manager calls the IDccManSink::OnLogActive method when the connection is established between the Windows CE-based device and Windows CE Services connection manager.
    4. The Windows CE Services connection manager calls the IDccManSink::OnLogIpAddr method, providing the IP address that it obtained for the communications socket.

    Note Only when the IDccManSink::OnLogIpAddr notification occurs is the connection completely established.

  3. Perform the desired processing in the application, which can include processing on the desktop, remote processing on the Windows CE-based device using remote application programming interface (RAPI), or calling the IDccMan methods. However, the application should wait to initialize RAPI, using CeRapiInit, until the IDccManSink::OnLogActive notification is received. This ensures that a connection is established between the desktop computer and the device.
    To receive notification when the Windows CE-based device disconnects from the desktop
  1. Initialize the COM library and register the application, as described in the previous section.
  2. Disconnect the device from the desktop computer. Windows CE Services notifies the application when the desktop computer and device are disconnected by calling the IDccManSink::OnLogDisconnection method.
  3. Perform the desired processing in the application. Because there is no connection to the device, this processing can only take place on the desktop computer.