本文整理汇总了C++中CMyComPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CMyComPtr::Close方法的具体用法?C++ CMyComPtr::Close怎么用?C++ CMyComPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMyComPtr
的用法示例。
在下文中一共展示了CMyComPtr::Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompressFiles
//.........这里部分代码省略.........
CProgressBox progressBox;
CProgressBox *progressBoxPointer = NULL;
screenRestorer.Save();
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kUpdating), 48);
NFind::CFileInfo fileInfo;
CMyComPtr<IOutFolderArchive> outArchive;
CMyComPtr<IInFolderArchive> archiveHandler;
if (fileInfo.Find(fullArchiveName))
{
if (fileInfo.IsDir())
throw "There is Directory with such name";
CAgent *agentSpec = new CAgent;
archiveHandler = agentSpec;
// CLSID realClassID;
CMyComBSTR archiveType;
RINOK(agentSpec->Open(NULL,
GetUnicodeString(fullArchiveName, CP_OEMCP), UString(),
// &realClassID,
&archiveType,
NULL));
if (archiverInfoFinal.Name.CompareNoCase((const wchar_t *)archiveType) != 0)
throw "Type of existing archive differs from specified type";
HRESULT result = archiveHandler.QueryInterface(
IID_IOutFolderArchive, &outArchive);
if (result != S_OK)
{
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return E_FAIL;
}
}
else
{
// HRESULT result = outArchive.CoCreateInstance(classID);
CAgent *agentSpec = new CAgent;
outArchive = agentSpec;
/*
HRESULT result = outArchive.CoCreateInstance(CLSID_CAgentArchiveHandler);
if (result != S_OK)
{
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return E_FAIL;
}
*/
}
CRecordVector<const wchar_t *> fileNamePointers;
fileNamePointers.Reserve(fileNames.Size());
for (i = 0; i < fileNames.Size(); i++)
fileNamePointers.Add(fileNames[i]);
outArchive->SetFolder(NULL);
outArchive->SetFiles(L"", &fileNamePointers.Front(), fileNamePointers.Size());
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
actionSetByte[i] = (BYTE)actionSet->StateActions[i];
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
updateCallbackSpec->Init(/* archiveHandler, */ progressBoxPointer);
RINOK(SetOutProperties(outArchive, compressionInfo.Level));
HRESULT result = outArchive->DoOperation(
codecs, archiverIndex,
tempFile.OutStream, actionSetByte,
NULL, updateCallback);
updateCallback.Release();
outArchive.Release();
if (result != S_OK)
{
ShowErrorMessage(result);
return result;
}
if (archiveHandler)
{
archiveHandler->Close();
}
if (!tempFile.MoveToOriginal(archiveHandler != NULL))
{
ShowLastErrorMessage();
return E_FAIL;
}
return S_OK;
}