本文整理汇总了C++中CArchive::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CArchive::Init方法的具体用法?C++ CArchive::Init怎么用?C++ CArchive::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArchive
的用法示例。
在下文中一共展示了CArchive::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCreateArchive
// message to create a Standard Archive from a stream
DWORD CArchiveFactory::OnCreateArchive(DWORD size, void *param)
{
CArchive *newArchive;
CREATEARCHIVE *ca;
CREATESTREAM cs;
StdString csMessage;
DWORD retVal;
VERIFY_MESSAGE_SIZE(size, sizeof(CREATEARCHIVE));
ca = (CREATEARCHIVE *)param;
cs.streamData = ca->streamData;
cs.streamSize = ca->streamSize;
cs.mode = ca->mode;
csMessage = _T("CreateStream_");
csMessage += ca->streamType->GetString();
// try and create the stream
DWORD msgHash_csMessage = CHashString(csMessage).GetUniqueID();
retVal = m_ToolBox->SendMessage(msgHash_csMessage, sizeof(CREATESTREAM), &cs);
if (retVal != MSG_HANDLED)
{
return retVal;
}
try
{
newArchive = new CArchive();
}
catch(...)
{
delete cs.openStream;
return MSG_ERROR;
}
// initialize it with the stream
newArchive->Init(cs.openStream);
// check if we are creating a read and write stream
if( (cs.mode & (STREAM_MODE_READ | STREAM_MODE_WRITE)) == (STREAM_MODE_READ | STREAM_MODE_WRITE))
{
// set to a write archive only if the ARCHIVE_MODE_WRITE flag is set
if((cs.mode & ARCHIVE_MODE_WRITE)==ARCHIVE_MODE_WRITE )
{
newArchive->SetIsWriting( true );
}
}
ca->archive = newArchive;
return MSG_HANDLED_STOP;
}