当前位置: 首页>>代码示例>>C++>>正文


C++ IPropertyStorage::Enum方法代码示例

本文整理汇总了C++中IPropertyStorage::Enum方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyStorage::Enum方法的具体用法?C++ IPropertyStorage::Enum怎么用?C++ IPropertyStorage::Enum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyStorage的用法示例。


在下文中一共展示了IPropertyStorage::Enum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyCom_BuildPyException

// @pymethod <o PyIEnumSTATPROPSTG>|PyIPropertyStorage|Enum|Creates an enumerator for properties in the property set
PyObject *PyIPropertyStorage::Enum(PyObject *self, PyObject *args)
{
	IPropertyStorage *pIPS = GetI(self);
	if ( pIPS == NULL )
		return NULL;
	IEnumSTATPROPSTG * ppenum;
	if ( !PyArg_ParseTuple(args, ":Enum") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIPS->Enum( &ppenum );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
	return PyCom_PyObjectFromIUnknown(ppenum, IID_IEnumSTATPROPSTG, FALSE);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:18,代码来源:PyIPropertyStorage.cpp

示例2: GetProperties


//.........这里部分代码省略.........

                // Headings:
                // =========
                // 0  - General
                // 2  - Mesh Totals
                // 4  - Scene Totals
                // 6  - External Dependencies
                // 8  - Objects
                // 10 - Materials
                // 12 - Plug-Ins

                int nDocPart = 0;
                for (UINT i=0; i<pHeading->cElems; i+=2) {
                    SendMessage(GetDlgItem(hPropDialog, IDC_CONTENTS), LB_ADDSTRING, 0, (LPARAM)pHeading->pElems[i].pszVal);
                    for (int j=0; j<pHeading->pElems[i+1].lVal; j++) {
                        sprintf(szBuf, "\t%s", pDocPart->pElems[nDocPart]);
                        SendMessage(GetDlgItem(hPropDialog, IDC_CONTENTS), LB_ADDSTRING, 0, (LPARAM)szBuf);
                        nDocPart++;
                    }
                }

            }

        }

        FreePropVariantArray(5, PropVar);
        pDocumentSummaryInfoStorage->Release();
    }

    if (S_OK == pPropertySetStorage->Open(FMTID_UserDefinedProperties, STGM_READ|STGM_SHARE_EXCLUSIVE, &pUserDefinedPropertyStorage)) {
        int		numUserProps = 0;

        // First we need to count the properties
        IEnumSTATPROPSTG*	pIPropertyEnum;
        if (S_OK == pUserDefinedPropertyStorage->Enum(&pIPropertyEnum)) {
            STATPROPSTG property;
            while (pIPropertyEnum->Next(1, &property, NULL) == S_OK) {
                if (property.lpwstrName) {
                    CoTaskMemFree(property.lpwstrName);
                    property.lpwstrName = NULL;
                    numUserProps++;
                }
            }

            PROPSPEC* pPropSpec = new PROPSPEC[numUserProps];
            PROPVARIANT* pPropVar = new PROPVARIANT[numUserProps];

            ZeroMemory(pPropVar, numUserProps*sizeof(PROPVARIANT));
            ZeroMemory(pPropSpec, numUserProps*sizeof(PROPSPEC));

            pIPropertyEnum->Reset();
            int idx = 0;
            while (pIPropertyEnum->Next(1, &property, NULL) == S_OK) {
                if (property.lpwstrName) {
                    pPropSpec[idx].ulKind = PRSPEC_LPWSTR;
                    pPropSpec[idx].lpwstr = (LPWSTR)CoTaskMemAlloc(sizeof(wchar_t)*(wcslen(property.lpwstrName)+1));
                    wcscpy(pPropSpec[idx].lpwstr, property.lpwstrName);
                    idx++;
                    CoTaskMemFree(property.lpwstrName);
                    property.lpwstrName = NULL;
                }
            }
            pIPropertyEnum->Release();

            ListView_DeleteAllItems(GetDlgItem(hPropDialog, IDC_CUSTOM));
            HRESULT hr = pUserDefinedPropertyStorage->ReadMultiple(idx, pPropSpec, pPropVar);
开发者ID:vasilenkomike,项目名称:xray,代码行数:67,代码来源:showpropdlg.cpp


注:本文中的IPropertyStorage::Enum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。