本文整理汇总了C++中IShellItem::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ IShellItem::Compare方法的具体用法?C++ IShellItem::Compare怎么用?C++ IShellItem::Compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IShellItem
的用法示例。
在下文中一共展示了IShellItem::Compare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: v_ExecuteLibCommand
HRESULT v_ExecuteLibCommand()
{
// Get the private and public save locations.
IShellItem *psiPrivateSaveLoc;
HRESULT hr = _plib->GetDefaultSaveFolder(DSFT_PRIVATE, IID_PPV_ARGS(&psiPrivateSaveLoc));
if (SUCCEEDED(hr))
{
IShellItem *psiPublicSaveLoc;
hr = _plib->GetDefaultSaveFolder(DSFT_PUBLIC, IID_PPV_ARGS(&psiPublicSaveLoc));
if (SUCCEEDED(hr))
{
// Get the list of folders that match the specified filter.
IShellItemArray *psiaFolders;
hr = _plib->GetFolders(_lffFilter, IID_PPV_ARGS(&psiaFolders));
if (SUCCEEDED(hr))
{
DWORD cFolders;
hr = psiaFolders->GetCount(&cFolders);
if (SUCCEEDED(hr))
{
Output(L"Library contains %u folders:\n", cFolders);
for (DWORD iFolder = 0; iFolder < cFolders; iFolder++)
{
IShellItem *psiFolder;
if (SUCCEEDED(psiaFolders->GetItemAt(iFolder, &psiFolder)))
{
// Print each folder's name as an absolute path, suitable for parsing in the Shell Namespace (e.g SHParseDisplayName).
// For file system folders (the typical case), this will be the file system path of the folder.
PWSTR pszDisplay;
if (SUCCEEDED(psiFolder->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &pszDisplay)))
{
PCWSTR pszPrefix = L" ";
int iCompare;
if (S_OK == psiPrivateSaveLoc->Compare(psiFolder, SICHINT_CANONICAL | SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL, &iCompare))
{
pszPrefix = L"* ";
}
else if (S_OK == psiPublicSaveLoc->Compare(psiFolder, SICHINT_CANONICAL | SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL, &iCompare))
{
pszPrefix = L"# ";
}
Output(L"%s%s\n", pszPrefix, pszDisplay);
CoTaskMemFree(pszDisplay);
}
psiFolder->Release();
}
}
}
psiaFolders->Release();
}
psiPublicSaveLoc->Release();
}
psiPrivateSaveLoc->Release();
}
return hr;
}
示例2: PyCom_BuildPyException
// @pymethod int|PyIShellItem|Compare|Compares another shell item with this item
// @rdesc Returns 0 if items compare as equal, nonzero otherwise
PyObject *PyIShellItem::Compare(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
// @pyparm <o PyIShellItem>|psi||A shell item to be compared with this item
SICHINTF hint;
// @pyparm int|hint||shellcon.SICHINT_* value indicating how the comparison is to be performed
PyObject *obpsi;
IShellItem *psi;
if ( !PyArg_ParseTuple(args, "Oi:Compare", &obpsi, &hint) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpsi, IID_IShellItem, (void **)&psi, FALSE))
return NULL;
HRESULT hr;
int iOrder;
PY_INTERFACE_PRECALL;
hr = pISI->Compare( psi, hint, &iOrder );
psi->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyInt_FromLong(iOrder);
}
示例3: _IsItemInArray
// Determines if the provided IShellItem is listed in the array of items that the user has removed
bool _IsItemInArray(IShellItem *psi, IObjectArray *poaRemoved)
{
bool fRet = false;
UINT cItems;
if (SUCCEEDED(poaRemoved->GetCount(&cItems)))
{
IShellItem *psiCompare;
for (UINT i = 0; !fRet && i < cItems; i++)
{
if (SUCCEEDED(poaRemoved->GetAt(i, IID_PPV_ARGS(&psiCompare))))
{
int iOrder;
fRet = SUCCEEDED(psiCompare->Compare(psi, SICHINT_CANONICAL, &iOrder)) && (0 == iOrder);
psiCompare->Release();
}
}
}
return fRet;
}