本文整理汇总了C++中CMyComPtr::SetProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ CMyComPtr::SetProperties方法的具体用法?C++ CMyComPtr::SetProperties怎么用?C++ CMyComPtr::SetProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMyComPtr
的用法示例。
在下文中一共展示了CMyComPtr::SetProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProperties
HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties)
{
if (properties.IsEmpty())
return S_OK;
CMyComPtr<ISetProperties> setProperties;
unknown->QueryInterface(IID_ISetProperties, (void **)&setProperties);
if (!setProperties)
return S_OK;
UStringVector realNames;
CPropVariant *values = new CPropVariant[properties.Size()];
try
{
int i;
for(i = 0; i < properties.Size(); i++)
{
const CProperty &property = properties[i];
NCOM::CPropVariant propVariant;
UString name = property.Name;
if (property.Value.IsEmpty())
{
if (!name.IsEmpty())
{
wchar_t c = name.Back();
if (c == L'-')
propVariant = false;
else if (c == L'+')
propVariant = true;
if (propVariant.vt != VT_EMPTY)
name.DeleteBack();
}
}
else
ParseNumberString(property.Value, propVariant);
realNames.Add(name);
values[i] = propVariant;
}
CRecordVector<const wchar_t *> names;
for(i = 0; i < realNames.Size(); i++)
names.Add((const wchar_t *)realNames[i]);
RINOK(setProperties->SetProperties(&names.Front(), values, names.Size()));
}
catch(...)
{
delete []values;
throw;
}
delete []values;
return S_OK;
}
示例2: SetOutProperties
static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method)
{
CMyComPtr<ISetProperties> setProperties;
if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
{
UStringVector realNames;
realNames.Add(UString(L"x"));
NCOM::CPropVariant value = (UInt32)method;
CRecordVector<const wchar_t *> names;
for (int i = 0; i < realNames.Size(); i++)
names.Add(realNames[i]);
RINOK(setProperties->SetProperties(&names.Front(), &value, names.Size()));
}
return S_OK;
}
示例3: DoOperation
//.........这里部分代码省略.........
}
CObjectVector<CArcItem> arcItems;
if (GetArchive())
{
RINOK(ReadItems());
EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", arcItems);
}
CRecordVector<CUpdatePair2> updatePairs2;
{
CRecordVector<CUpdatePair> updatePairs;
GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs);
CAgUpCallbackImp upCallback(&arcItems, updateCallback100);
UpdateProduce(updatePairs, actionSet, updatePairs2, &upCallback);
}
UInt32 numFiles = 0;
for (i = 0; i < updatePairs2.Size(); i++)
if (updatePairs2[i].NewData)
numFiles++;
if (updateCallback100)
{
RINOK(updateCallback100->SetNumFiles(numFiles));
}
CUpdateCallbackAgent updateCallbackAgent;
updateCallbackAgent.SetCallback(updateCallback100);
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec );
updateCallbackSpec->DirItems = &dirItems;
updateCallbackSpec->ArcItems = &arcItems;
updateCallbackSpec->UpdatePairs = &updatePairs2;
updateCallbackSpec->Archive = GetArchive();
updateCallbackSpec->Callback = &updateCallbackAgent;
COutFileStream *outStreamSpec = new COutFileStream;
CMyComPtr<IOutStream> outStream(outStreamSpec);
UString archiveName = newArchiveName;
{
UString resultPath;
int pos;
if(!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
return E_FAIL;
NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
}
if (!outStreamSpec->Create(archiveName, true))
{
// ShowLastErrorMessage();
return E_FAIL;
}
CMyComPtr<ISetProperties> setProperties;
if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
{
if (m_PropNames.Size() == 0)
{
RINOK(setProperties->SetProperties(0, 0, 0));
}
else
{
CRecordVector<const wchar_t *> names;
for(i = 0; i < m_PropNames.Size(); i++)
names.Add((const wchar_t *)m_PropNames[i]);
NWindows::NCOM::CPropVariant *propValues = new NWindows::NCOM::CPropVariant[m_PropValues.Size()];
try
{
for (int i = 0; i < m_PropValues.Size(); i++)
propValues[i] = m_PropValues[i];
RINOK(setProperties->SetProperties(&names.Front(), propValues, names.Size()));
}
catch(...)
{
delete []propValues;
return E_FAIL;
}
delete []propValues;
}
}
m_PropNames.Clear();
m_PropValues.Clear();
if (sfxModule != NULL)
{
CInFileStream *sfxStreamSpec = new CInFileStream;
CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
if (!sfxStreamSpec->Open(sfxModule))
return E_FAIL;
// throw "Can't open sfx module";
RINOK(CopyBlock(sfxStream, outStream));
}
RINOK(outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback));
return outStreamSpec->Close();
}