本文整理汇总了C++中IPersistStream::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IPersistStream::Release方法的具体用法?C++ IPersistStream::Release怎么用?C++ IPersistStream::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersistStream
的用法示例。
在下文中一共展示了IPersistStream::Release方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadPropertyStoreFromStream
HRESULT LoadPropertyStoreFromStream(IStream *pstm, REFIID riid, void **ppv)
{
*ppv = NULL;
STATSTG stat;
HRESULT hr = pstm->Stat(&stat, STATFLAG_NONAME);
if (SUCCEEDED(hr))
{
IPersistStream *pps;
hr = PSCreateMemoryPropertyStore(IID_PPV_ARGS(&pps));
if (SUCCEEDED(hr))
{
if (stat.cbSize.QuadPart == 0)
{
hr = S_OK; // empty stream => empty property store
}
else if (stat.cbSize.QuadPart > (128 * 1024))
{
hr = STG_E_MEDIUMFULL; // can't be that large
}
else
{
hr = pps->Load(pstm);
}
if (SUCCEEDED(hr))
{
hr = pps->QueryInterface(riid, ppv);
}
pps->Release();
}
}
return hr;
}
示例2: LoadFromFile
HRESULT CLTDMLoader::LoadFromFile(LPDMUS_OBJECTDESC pDesc,IDirectMusicObject8 ** ppIObject)
{
HRESULT hr;
hr = CoCreateInstance(pDesc->guidClass,
NULL,CLSCTX_INPROC_SERVER,IID_IDirectMusicObject8,
(void **) ppIObject);
if (SUCCEEDED(hr))
{
WCHAR wzFullPath[DMUS_MAX_FILENAME];
ZeroMemory( wzFullPath, sizeof(WCHAR) * DMUS_MAX_FILENAME );
CLTDMFileStream *pStream = new CLTDMFileStream ( this );
if (pStream)
{
if (pDesc->dwValidData & DMUS_OBJ_FULLPATH)
{
wcscpy(wzFullPath,pDesc->wszFileName);
}
else
{
// find the directory that matches this class and copy it to the path
CLoadDirByClassItem* pItem = m_pLoadDirByClassList->Find(pDesc->guidClass);
if (pItem != NULL) wcscpy(wzFullPath, pItem->GetPath());
// check if slash was on end of string if not add it
if ((wzFullPath[wcslen(wzFullPath)-1] != m_wszBackSlash[0]) &&
(wzFullPath[wcslen(wzFullPath)-1] != m_wszForwardSlash[0]))
{
wcscat(wzFullPath, m_wszBackSlash);
}
// add filename to string
wcscat(wzFullPath, pDesc->wszFileName);
}
hr = pStream->Open(wzFullPath,GENERIC_READ);
if (SUCCEEDED(hr))
{
IPersistStream* pIPS;
hr = (*ppIObject)->QueryInterface( IID_IPersistStream, (void**)&pIPS );
if (SUCCEEDED(hr))
{
// Now that we have the IPersistStream interface from the object, we can ask it to load from our stream!
hr = pIPS->Load( pStream );
pIPS->Release();
}
}
pStream->Release();
}
else
{
hr = E_OUTOFMEMORY;
}
if (FAILED(hr))
{
(*ppIObject)->Release();
}
}
return hr;
}
示例3: LoadGraphFile
HRESULT CDShowCtrl::LoadGraphFile(IGraphBuilder *pGraph, const WCHAR* wszName)
{
IStorage *pStorage = 0;
if (S_OK != StgIsStorageFile(wszName))
{
return E_FAIL;
}
HRESULT hr = StgOpenStorage(wszName, 0,
STGM_TRANSACTED | STGM_READ | STGM_SHARE_DENY_WRITE,
0, 0, &pStorage);
if (FAILED(hr))
{
return hr;
}
IPersistStream *pPersistStream = 0;
hr = pGraph->QueryInterface(IID_IPersistStream,
reinterpret_cast<void**>(&pPersistStream));
if (SUCCEEDED(hr))
{
IStream *pStream = 0;
hr = pStorage->OpenStream(L"ActiveMovieGraph", 0,
STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
if(SUCCEEDED(hr))
{
hr = pPersistStream->Load(pStream);
pStream->Release();
}
pPersistStream->Release();
}
pStorage->Release();
return hr;
}
示例4: SaveSerializedPropStorageToStream
HRESULT SaveSerializedPropStorageToStream(IPersistSerializedPropStorage *psps, IStream *pstm)
{
IPersistStream *pPersistStream;
HRESULT hr = psps->QueryInterface(IID_PPV_ARGS(&pPersistStream));
if (SUCCEEDED(hr))
{
// implement size limit here
hr = pPersistStream->Save(pstm, TRUE);
pPersistStream->Release();
}
return hr;
}
示例5: SaveGraph
/* 把当前工作的滤波器链表保存到*.grf */
void CVMR_Capture::SaveGraph(CString wFileName)
{
HRESULT hr;
{
IStorage* pStorage=NULL;
// First, create a document file that will hold the GRF file
hr = ::StgCreateDocfile(wFileName.AllocSysString(), STGM_CREATE|STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &pStorage);
if (FAILED(hr))
{
AfxMessageBox(TEXT("Can not create a document"));
return;
}
// Next, create a stream to store.
WCHAR wszStreamName[] = L"ActiveMovieGraph";
IStream *pStream;
hr = pStorage->CreateStream(wszStreamName,STGM_WRITE|STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &pStream);
if(FAILED(hr))
{
AfxMessageBox(TEXT("Can not create a stream"));
pStorage->Release();
return;
}
// The IpersistStream::Save method converts a stream
// into a persistent object.
IPersistStream *pPersist = NULL;
m_pGB->QueryInterface(IID_IPersistStream, reinterpret_cast<void**>(&pPersist));
hr = pPersist->Save(pStream, TRUE);
pStream->Release();
pPersist->Release();
if(SUCCEEDED(hr))
{
hr = pStorage->Commit(STGC_DEFAULT);
if (FAILED(hr))
{
AfxMessageBox(TEXT("can not store it"));
}
}
pStorage->Release();
}
}
示例6: HError
HRESULT CPkcs7::SaveIntoJavaClassFile(FILEHANDLE hFile,LPCOLESTR wszFileName,BOOL fClearDirty)
// Save this signed data (presumably already signed) into the right place in the class file
{
HRESULT hr = S_OK;
CFileStream stm;
if (stm.OpenFileForWriting(hFile, wszFileName, FALSE))
{
IPersistStream* pPerStream;
hr = CJavaClassFile::CreateInstance(NULL, IID_IPersistStream, (LPVOID*)&pPerStream);
if (hr == S_OK)
{
hr = pPerStream->Load(&stm); // load the class file
if (hr == S_OK)
{
BLOB b;
hr = CPersistMemoryHelper2::Save(&b, FALSE); // get our bits
if (hr == S_OK)
{
IInsertSig* pSig;
hr = pPerStream->QueryInterface(IID_IInsertSig, (LPVOID*)&pSig);
if (hr == S_OK)
{
hr = pSig->SaveSig(&b); // stuff our bits in
pSig->Release();
}
FreeTaskMem(b);
}
if (hr == S_OK)
{
stm.Reset();
stm.Truncate();
hr = pPerStream->Save(&stm, FALSE); // save the class file
}
}
pPerStream->Release();
}
}
else
hr = HError();
if (hr == S_OK && fClearDirty)
m_isDirty = FALSE;
return hr;
}
示例7: SaveGraphFile
// This code was also brazenly stolen from the DX9 SDK
// Pass it a file name in wszPath, and it will save the filter graph to that file.
HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath)
{
const WCHAR wszStreamName[] = L"ActiveMovieGraph";
HRESULT hr;
IStorage *pStorage = NULL;
// First, create a document file which will hold the GRF file
hr = StgCreateDocfile(
wszPath,
STGM_CREATE | STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
0, &pStorage);
if(FAILED(hr))
{
return hr;
}
// Next, create a stream to store.
IStream *pStream;
hr = pStorage->CreateStream(
wszStreamName,
STGM_WRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
0, 0, &pStream);
if (FAILED(hr))
{
pStorage->Release();
return hr;
}
// The IPersistStream converts a stream into a persistent object.
IPersistStream *pPersist = NULL;
pGraph->QueryInterface(IID_IPersistStream, reinterpret_cast<void**>(&pPersist));
hr = pPersist->Save(pStream, TRUE);
pStream->Release();
pPersist->Release();
if (SUCCEEDED(hr))
{
hr = pStorage->Commit(STGC_DEFAULT);
}
pStorage->Release();
return hr;
}
示例8: SaveGraphFile
HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath)
{
const WCHAR wszStreamName[] = L"ActiveMovieGraph";
HRESULT hr;
IStorage *pStorage = NULL;
hr = StgCreateDocfile(
wszPath,
STGM_CREATE | STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
0, &pStorage);
if(FAILED(hr))
{
return hr;
}
IStream *pStream;
hr = pStorage->CreateStream(
wszStreamName,
STGM_WRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
0, 0, &pStream);
if (FAILED(hr))
{
pStorage->Release();
return hr;
}
IPersistStream *pPersist = NULL;
pGraph->QueryInterface(IID_IPersistStream, (void**)&pPersist);
hr = pPersist->Save(pStream, TRUE);
pStream->Release();
pPersist->Release();
if (SUCCEEDED(hr))
{
hr = pStorage->Commit(STGC_DEFAULT);
}
pStorage->Release();
return hr;
}
示例9: LoadFromMemory
HRESULT CLTDMLoader::LoadFromMemory(LPDMUS_OBJECTDESC pDesc,IDirectMusicObject8 ** ppIObject)
{
HRESULT hr;
hr = CoCreateInstance(pDesc->guidClass,
NULL,CLSCTX_INPROC_SERVER,IID_IDirectMusicObject8,
(void **) ppIObject);
if (SUCCEEDED(hr))
{
CLTDMMemStream *pStream = new CLTDMMemStream ( this );
if (pStream)
{
hr = pStream->Open(pDesc->pbMemData,pDesc->llMemLength);
if (SUCCEEDED(hr))
{
IPersistStream* pIPS;
hr = (*ppIObject)->QueryInterface( IID_IPersistStream, (void**)&pIPS );
if (SUCCEEDED(hr))
{
// Now that we have the IPersistStream interface from the object, we can ask it to load from our stream!
hr = pIPS->Load( pStream );
pIPS->Release();
}
}
pStream->Release();
}
else
{
hr = E_OUTOFMEMORY;
}
if (FAILED(hr))
{
(*ppIObject)->Release();
}
}
return hr;
}