locked
Knowledge about C++ sync application. RRS feed

  • Question

  • I want to write a C++ application. But i am unable to file Synchronization.lib, FileSyncProvider.lib and Synchronization.h.

    Where do i find them. I have installed the CTP2SyncSetup_x86.exe on my system. I am using windows vista. But this setup only generates dlls on the path.

    Please can anyone help and do anyone have any kind of sample of C++ sync application?


    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:07 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Friday, May 9, 2008 5:01 AM

Answers

  • Please look in \Program Files\Microsoft SDKs\Microsoft Sync Framework\v1.0 to find the SDK. You should find the lib and header files under that path.

     

    The files you see under \Program Files\Microsoft Sync Framework are the runtime.

     

    Thanks,

    Neil

    Monday, May 12, 2008 9:16 PM

All replies

  • When you install the Sync Framework, the COM dlls are registered. (Libs will not be shipped in the package)

    To use the Sync Framework, you will need to use COM pattern.

     

    for example:

    HRESULT hr = CoCreateInstance(CLSID_SyncServices, NULL, CLSCTX_INPROC_SERVER,  IID_IApplicationSyncServices, (void **) &pApplicationSyncServices);

     

    and start from there.
    Friday, May 9, 2008 7:45 PM
    Answerer
  • You can download the help documentation from http://www.microsoft.com/downloads/details.aspx?familyid=a3ee7bc5-a823-4fb4-b152-9e8ce9d5546f&displaylang=en

     

    The documentation has detailed steps and examples about how to create a native sync provider and how to create sync application.

     

    here is a copy of the sample code from the documentation to start a sync between 2 providers.

     

    HRESULT Synchronize(ISyncProvider* pProvSrc, ISyncProvider* pProvDest)
    {
        HRESULT hr = E_UNEXPECTED;
    
        IApplicationSyncServices* pSvc = NULL;
        hr = CoCreateInstance(CLSID_SyncServices, NULL, CLSCTX_INPROC_SERVER, 
            IID_IApplicationSyncServices, (void**)&pSvc);
        if (SUCCEEDED(hr))
        {
            ISyncSession* pSession = NULL;
            hr = pSvc->CreateSyncSession(pProvDest, pProvSrc, &pSession);
            if (SUCCEEDED(hr))
            {
                SYNC_SESSION_STATISTICS syncStats;
                // Arbitrarily choose "destination wins" conflict resolution
                hr = pSession->Start(CRP_DESTINATION_PROVIDER_WINS, &syncStats);
                if (SUCCEEDED(hr))
                {
                    // Display the session statistics to the user.
                    CString strMsg;
                    strMsg.Format(L"%d changes succeeded.\n%d changes failed.", syncStats.dwChangesApplied,
                        syncStats.dwChangesFailed);
                    MessageBox(NULL, strMsg.GetString(), L"Synchronization Statistics", MB_ICONINFORMATION);
                }
    
                pSession->Release();
            }
    
            pSvc->Release();
        }
    
        return hr;
    }
    
    Sunday, May 11, 2008 5:20 PM
    Answerer
  • Please look in \Program Files\Microsoft SDKs\Microsoft Sync Framework\v1.0 to find the SDK. You should find the lib and header files under that path.

     

    The files you see under \Program Files\Microsoft Sync Framework are the runtime.

     

    Thanks,

    Neil

    Monday, May 12, 2008 9:16 PM