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

SQL Anywhere 12.0.0 (中文) » UltraLite - C 及 C++ 编程 » 应用程序开发 » 开发用于 Windows Mobile 的 UltraLite 应用程序 » 在 Windows Mobile 上进行同步

 

添加 ActiveSync 同步 (Windows API)

如果直接针对 Windows API 进行编程,则必须在应用程序的 WindowProc 函数中处理来自 MobiLink 提供程序的消息,使用 ULIsSynchronizeMessage 函数确定应用程序是否已收到消息。

下面是如何处理该消息的一个示例:



LRESULT CALLBACK WindowProc( HWND hwnd,
         UINT uMsg,
         WPARAM wParam,
         LPARAM lParam )
{
  if( ULIsSynchronizeMessage( uMsg ) ) {
    DoSync();
    if( wParam == 1 ) DestroyWindow( hWnd );
    return 0;
  }
  switch( uMsg ) {
  // code to handle other windows messages
  default:
    return DefWindowProc( hwnd, uMsg, wParam, lParam );
  }
  return 0;
}

其中 DoSync 是实际调用 ULSynchronize 的方法。

请参见ULIsSynchronizeMessage 方法