Exemple #1
0
/*----------------------------------------------------------------------------------------------
	Create a LgTsEnumFORMATETC object.

	@param ppenum Address of a pointer for returning the newly created LgTsEnumFORMATETC COM
					object.
----------------------------------------------------------------------------------------------*/
void LgTsEnumFORMATETC::Create(IEnumFORMATETC ** ppenum)
{
	AssertPtr(ppenum);

	ComSmartPtr<LgTsEnumFORMATETC> qtsenum;
	qtsenum.Attach(NewObj LgTsEnumFORMATETC);
	*ppenum = qtsenum.Detach();
}
Exemple #2
0
/*----------------------------------------------------------------------------------------------
	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();
}
Exemple #3
0
/*----------------------------------------------------------------------------------------------
	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();
}
Exemple #4
0
/*----------------------------------------------------------------------------------------------
	Create a new stream object that references the same bytes as the original stream but
	provides a separate seek pointer to those bytes.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ResourceStream::Clone(IStream ** ppstm)
{
	BEGIN_COM_METHOD;
	// Validate the pointer
	ChkComOutPtr(ppstm);

	// Create a new object
	ComSmartPtr<ResourceStream> qrest;
	qrest.Attach(NewObj ResourceStream);

	// Initialize the new object
	qrest->m_cbData = m_cbData;
	qrest->m_prgbData = m_prgbData;
	qrest->m_pbCur = m_pbCur;

	*ppstm = qrest.Detach();
	END_COM_METHOD(g_fact, IID_IStream);
}