本文整理汇总了C++中IShellItem::GetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ IShellItem::GetAttributes方法的具体用法?C++ IShellItem::GetAttributes怎么用?C++ IShellItem::GetAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IShellItem
的用法示例。
在下文中一共展示了IShellItem::GetAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyCom_BuildPyException
// @pymethod int|PyIShellItem|GetAttributes|Returns shell attributes of the item
// @rdesc Returns a combination of shellcon.SFGAO_* values
PyObject *PyIShellItem::GetAttributes(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
SFGAOF sfgaoMask;
SFGAOF ret;
// @pyparm int|Mask||Combination of shellcon.SFGAO_* values indicating the flags to return
if ( !PyArg_ParseTuple(args, "k:GetAttributes", &sfgaoMask) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISI->GetAttributes( sfgaoMask, &ret);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyLong_FromUnsignedLong(ret);
}
示例2: OnSelectionChange
IFACEMETHODIMP OnSelectionChange(IFileDialog *pfd)
{
// Update the text of the Open/Add button here based on the selection
IShellItem *psi;
HRESULT hr = pfd->GetCurrentSelection(&psi);
if (SUCCEEDED(hr))
{
SFGAOF attr;
hr = psi->GetAttributes(SFGAO_FOLDER | SFGAO_STREAM, &attr);
if (SUCCEEDED(hr) && (SFGAO_FOLDER == attr))
{
pfd->SetOkButtonLabel(L"Open");
}
else
{
pfd->SetOkButtonLabel(L"Add");
}
psi->Release();
}
return S_OK;
}
示例3: getPaths
void getPaths(IShellItemArray* shellItems, Vector<Path>& paths)
{
DWORD numShellItems;
shellItems->GetCount(&numShellItems);
for (DWORD i = 0; i < numShellItems; ++i)
{
IShellItem* shellItem = nullptr;
shellItems->GetItemAt(i, &shellItem);
SFGAOF attribs;
shellItem->GetAttributes(SFGAO_FILESYSTEM, &attribs);
if (!(attribs & SFGAO_FILESYSTEM))
continue;
LPWSTR name;
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name);
paths.push_back((Path)UTF8::fromWide(WString(name)));
CoTaskMemFree(name);
}
}