Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Multimedia API Help

IltmmConvert::SaveSettingsToStream Example for C++

Show in webframe

void SaveConvertSettingsToStream(IltmmConvert *pConvert)
{
   IltmmMemory* pMem;
   IStream *pStream = NULL;
   LARGE_INTEGER li;
   ULARGE_INTEGER liOffset;
   li.QuadPart = 0;

   // try to create the ltmmMemory object
   HRESULT hr = CoCreateInstance(CLSID_ltmmMemory, NULL, CLSCTX_INPROC_SERVER, IID_IltmmMemory, (void**)&pMem);

   if (SUCCEEDED(hr))
   {
      // get a stream interface
      hr = pMem->QueryInterface(IID_IStream, (void**)&pStream);

      if (SUCCEEDED(hr))
      {
         // get current stream position 
         pStream->Seek(li, STREAM_SEEK_CUR, &liOffset);
         hr = pConvert->SaveSettingsToStream((IUnknown*)pMem, ltmmConvert_Settings_All);

         if (SUCCEEDED(hr))
         {
            // Seek back
            li.QuadPart = liOffset.QuadPart;
            pStream->Seek(li, STREAM_SEEK_SET, NULL);
            pStream->Release();

            // try to load the saved settings
            hr = pConvert->LoadSettingsFromStream((IUnknown*)pMem, ltmmConvert_Settings_All);
            if (SUCCEEDED(hr))
            {
               // everything saved and loaded ok
            }
         }

         // release the stream
         pStream->Release();
      }

      // release the ltmmMemory object
      pMem->Release();
   }
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.