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 » Ultra Light C/C++ プログラミング » アプリケーション開発 » Windows Mobile 向け Ultra Light アプリケーション開発 » Windows Mobile の同期

 

アプリケーションクラスでの ActiveSync 同期の追加

アプリケーションクラスで同期メッセージを取得します。

前提条件

アプリケーションを開発するには、Microsoft Foundation Classes を使用する必要があります。

メッセージの通知用に、アプリケーションのカスタムウィンドウクラス名を作成し、登録しておいてください。

 ♦ タスク
  1. アプリケーションクラスのクラスウィザードを開きます。

  2. [メッセージ] リストで、PreTranslateMessage を強調表示して [関数の追加] をクリックします。

  3. [コードの編集] をクリックします。

    PreTranslateMessage メソッドが表示されます。

  4. 次のように PreTranslateMessage メソッドを変更します。



    BOOL CMyApp::PreTranslateMessage(MSG* pMsg)
    {
     if( ULIsSynchronizeMessage(pMsg->message) ) {
      DoSync();
      // 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);
    }

    DoSync メソッドが ULSynchronize メソッドを呼び出す。

結果

PreTranslateMessage メソッドが同期を実行します。

 参照