/*---------------------------------------------------------------------------------------------- Static method to create a new FileStream object, opening the specified file in the specified mode. @param pszFile Name (or path) of the desired file (LPCOLESTR) @param grfstgm Combination of flags kfstgmXxxx from enum in FileStrm.h @return The associated IStream interface pointer if successful (third parameter). ----------------------------------------------------------------------------------------------*/ void FileStream::Create(LPCOLESTR pszFile, int grfstgm, IStream ** ppstrm) { AssertPsz(pszFile); AssertPtr(ppstrm); Assert(!*ppstrm); ComSmartPtr<FileStream> qfist; qfist.Attach(NewObj FileStream); qfist->Init(pszFile, grfstgm); *ppstrm = qfist.Detach(); }
/*---------------------------------------------------------------------------------------------- Static method to create a new ResourceStream object, to open the specified resource for reading, and to return the associated IStream interface pointer if successful. @param hmod Handle of the module containing the resource @param pszType Pointer to resource type @param rid Integer identifier of the resource ----------------------------------------------------------------------------------------------*/ void ResourceStream::Create(HMODULE hmod, const achar * pszType, int rid, IStream ** ppstrm) { AssertPtr(ppstrm); Assert(!*ppstrm); ComSmartPtr<ResourceStream> qrest; qrest.Attach(NewObj ResourceStream); qrest->Init(hmod, pszType, rid); *ppstrm = qrest.Detach(); }