IltmmCapture::SaveSettingsToStream Example for C++
Show in webframe
void SaveCaptureSettingsToStream(IltmmCapture *pCapture)
{
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 = pCapture->SaveSettingsToStream((IUnknown*)pMem, ltmmCapture_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 = pCapture->LoadSettingsFromStream((IUnknown*)pMem, ltmmCapture_Settings_All);
if (SUCCEEDED(hr))
{
// everything saved and loaded ok
}
}
// release the stream
pStream->Release();
}
// release the ltmmMemory object
pMem->Release();
}
}