本文整理汇总了C++中IPropertyStorage::ReadPropertyNames方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyStorage::ReadPropertyNames方法的具体用法?C++ IPropertyStorage::ReadPropertyNames怎么用?C++ IPropertyStorage::ReadPropertyNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyStorage
的用法示例。
在下文中一共展示了IPropertyStorage::ReadPropertyNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetI
// @pymethod (str,...)|PyIPropertyStorage|ReadPropertyNames|Retrieves any existing string names for the specified property identifiers.
PyObject *PyIPropertyStorage::ReadPropertyNames(PyObject *self, PyObject *args)
{
IPropertyStorage *pIPS = GetI(self);
if ( pIPS == NULL )
return NULL;
PyObject *obProps;
// @pyparm (int, ...)|props||Sequence of ints containing property IDs.
if ( !PyArg_ParseTuple(args, "O:ReadPropertyNames", &obProps))
return NULL;
ULONG cProps;
PROPID *pProps;
if (!PyObject_AsPROPIDs( obProps, &pProps, &cProps))
return NULL;
HRESULT hr;
LPWSTR *ppStrs = new LPWSTR[cProps];
if (ppStrs==NULL){
PyErr_NoMemory();
goto cleanup;
}
memset(ppStrs, 0, sizeof(LPWSTR)*cProps);
{
PY_INTERFACE_PRECALL;
hr = pIPS->ReadPropertyNames( cProps, pProps, ppStrs );
PY_INTERFACE_POSTCALL;
}
PyObject *rc;
if ( FAILED(hr) )
rc = PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
else {
rc = PyTuple_New(cProps);
if (rc==NULL)
goto cleanup;
for (ULONG i=0;i<cProps;i++){
PyObject *propname=PyWinObject_FromOLECHAR(ppStrs[i]);
if (propname==NULL){
Py_DECREF(rc);
rc=NULL;
goto cleanup;
}
PyTuple_SET_ITEM( rc, i, propname);
}
}
cleanup:
if (ppStrs){
for (ULONG i=0;i<cProps;i++)
if (ppStrs[i])
CoTaskMemFree(ppStrs[i]);
delete [] ppStrs;
}
PyObject_FreePROPIDs(pProps, cProps);
return rc;
}