Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - C and C++ Programming » Application development » UltraLite application development for Windows Mobile » Windows Mobile synchronization


Adding ActiveSync synchronization in the Application class

Catch synchronization messages in your application class.


You must use Microsoft Foundation Classes to develop your application.

Your application must create and register a custom window class name for notification.

  1. Open the Class Wizard for the application class.

  2. In the Messages list, highlight PreTranslateMessage and then click Add Function.

  3. Click Edit Code.

    The PreTranslateMessage method appears.

  4. Change the PreTranslateMessage method to read as follows:

    BOOL CMyApp::PreTranslateMessage(MSG* pMsg)
     if( ULIsSynchronizeMessage(pMsg->message) ) {
      // close application if launched by provider
      if( pMsg->wParam == 1 ) {
       ASSERT( AfxGetMainWnd() != NULL );
       AfxGetMainWnd()->SendMessage( WM_CLOSE );
      return TRUE; // message has been processed
     return CWinApp::PreTranslateMessage(pMsg);

    where the DoSync method calls the ULSynchronize method.


The PreTranslateMessage method performs a synchronization.

 See also