本文整理汇总了C++中IPropertyStorage::ReadMultiple方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyStorage::ReadMultiple方法的具体用法?C++ IPropertyStorage::ReadMultiple怎么用?C++ IPropertyStorage::ReadMultiple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyStorage
的用法示例。
在下文中一共展示了IPropertyStorage::ReadMultiple方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetI
// @pymethod (object, ...)|PyIPropertyStorage|ReadMultiple|Reads specified properties from the current property set.
// @rdesc Returned values are automatically converted to an appropriate python type
PyObject *PyIPropertyStorage::ReadMultiple(PyObject *self, PyObject *args)
{
IPropertyStorage *pIPS = GetI(self);
if ( pIPS == NULL )
return NULL;
PyObject *props;
// @pyparm (<o PROPSPEC>, ...)|props||Sequence of property IDs or names.
if ( !PyArg_ParseTuple(args, "O:ReadMultiple", &props))
return NULL;
ULONG cProps;
PROPSPEC *pProps;
if (!PyWinObject_AsPROPSPECs( props, &pProps, &cProps))
return NULL;
PROPVARIANT *pPropVars = new PROPVARIANT[cProps];
if (pPropVars==NULL) {
PyObject_FreePROPSPECs(pProps, cProps);
PyErr_SetString(PyExc_MemoryError, "allocating PROPVARIANTs");
return NULL;
}
ULONG i;
for (i=0;i<cProps;i++)
PropVariantInit(pPropVars+i);
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIPS->ReadMultiple( cProps, pProps, pPropVars );
PY_INTERFACE_POSTCALL;
PyObject *rc;
if ( FAILED(hr) )
rc = PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
else
rc = PyObject_FromPROPVARIANTs(pPropVars, cProps);
// Cleanup the property IDs.
PyObject_FreePROPSPECs( pProps, cProps );
// Cleanup the prop variants.
for (i=0;i<cProps;i++) {
PropVariantClear(pPropVars+i);
}
delete [] pPropVars;
return rc;
}
示例2: GetProperties
void App::GetProperties()
{
LPSTORAGE pStorage = NULL;
IPropertySetStorage* pPropertySetStorage = NULL;
IPropertyStorage* pSummaryInfoStorage = NULL;
IPropertyStorage* pDocumentSummaryInfoStorage = NULL;
IPropertyStorage* pUserDefinedPropertyStorage = NULL;
wchar_t wfilename[_MAX_PATH];
char szBuf[256];
char filename[MAX_PATH];
SendMessage(GetDlgItem(hPropDialog, IDC_TITLE), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_SUBJECT), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_AUTHOR), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_MANAGER), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_COMPANY), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_CATEGORY), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_KEYWORDS), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_COMMENTS), WM_SETTEXT, 0, (LPARAM)"");
SendMessage(GetDlgItem(hPropDialog, IDC_CONTENTS), LB_RESETCONTENT, 0, 0);
ListView_DeleteAllItems(GetDlgItem(hPropDialog, IDC_CUSTOM));
int idx = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
SendMessage(hListBox, LB_GETTEXT, idx, (LPARAM)filename);
SetWindowText(hPropDialog, filename);
MultiByteToWideChar(CP_ACP, 0, filename, -1, wfilename, _MAX_PATH);
HRESULT res = StgOpenStorage(wfilename, (LPSTORAGE)0, STGM_DIRECT|STGM_READ|STGM_SHARE_EXCLUSIVE, NULL,0,&pStorage);
if (res!=S_OK) {
return;
}
// Get the Storage interface
if (S_OK != pStorage->QueryInterface(IID_IPropertySetStorage, (void**)&pPropertySetStorage)) {
pStorage->Release();
return;
}
// Get the SummaryInfo property set interface
if (S_OK == pPropertySetStorage->Open(FMTID_SummaryInformation, STGM_READ|STGM_SHARE_EXCLUSIVE, &pSummaryInfoStorage)) {
BOOL bFound = FALSE;
PROPSPEC PropSpec[5];
PROPVARIANT PropVar[5];
PropSpec[0].ulKind = PRSPEC_PROPID;
PropSpec[0].propid = PID_TITLE;
PropSpec[1].ulKind = PRSPEC_PROPID;
PropSpec[1].propid = PID_SUBJECT;
PropSpec[2].ulKind = PRSPEC_PROPID;
PropSpec[2].propid = PID_AUTHOR;
PropSpec[3].ulKind = PRSPEC_PROPID;
PropSpec[3].propid = PID_KEYWORDS;
PropSpec[4].ulKind = PRSPEC_PROPID;
PropSpec[4].propid = PID_COMMENTS;
HRESULT hr = pSummaryInfoStorage->ReadMultiple(5, PropSpec, PropVar);
if (S_OK == hr) {
if (PropVar[0].vt == VT_LPSTR) {
SendMessage(GetDlgItem(hPropDialog, IDC_TITLE), WM_SETTEXT, 0, (LPARAM)PropVar[0].pszVal);
}
if (PropVar[1].vt == VT_LPSTR) {
SendMessage(GetDlgItem(hPropDialog, IDC_SUBJECT), WM_SETTEXT, 0, (LPARAM)PropVar[1].pszVal);
}
if (PropVar[2].vt == VT_LPSTR) {
SendMessage(GetDlgItem(hPropDialog, IDC_AUTHOR), WM_SETTEXT, 0, (LPARAM)PropVar[2].pszVal);
}
if (PropVar[3].vt == VT_LPSTR) {
SendMessage(GetDlgItem(hPropDialog, IDC_KEYWORDS), WM_SETTEXT, 0, (LPARAM)PropVar[3].pszVal);
}
if (PropVar[4].vt == VT_LPSTR) {
SendMessage(GetDlgItem(hPropDialog, IDC_COMMENTS), WM_SETTEXT, 0, (LPARAM)PropVar[4].pszVal);
}
}
FreePropVariantArray(5, PropVar);
pSummaryInfoStorage->Release();
}
// Get the DocumentSummaryInfo property set interface
if (S_OK == pPropertySetStorage->Open(FMTID_DocSummaryInformation, STGM_READ|STGM_SHARE_EXCLUSIVE, &pDocumentSummaryInfoStorage)) {
BOOL bFound = FALSE;
PROPSPEC PropSpec[5];
PROPVARIANT PropVar[5];
PropSpec[0].ulKind = PRSPEC_PROPID;
PropSpec[0].propid = PID_MANAGER;
PropSpec[1].ulKind = PRSPEC_PROPID;
PropSpec[1].propid = PID_COMPANY;
PropSpec[2].ulKind = PRSPEC_PROPID;
//.........这里部分代码省略.........
示例3: Load
//.........这里部分代码省略.........
{L"Doc Security", PIDSI_DOC_SECURITY},
{0, 0}
}, pidsdiArr[] = {
{L"Company", PIDDSI_COMPANY},
{L"Slide notes", PIDDSI_SLIDECOUNT},
{0, 0}
};
// Count elements in pidsiArr.
INT nPidsi = 0, nPidsdi = 0;
for(nPidsi=0; pidsiArr[nPidsi].name; nPidsi++);
for(nPidsdi=0; pidsdiArr[nPidsdi].name; nPidsdi++);
// Initialize PROPSPEC for the properties you want.
PROPSPEC *pPropSpec = new PROPSPEC [nPidsi];
PROPVARIANT *pPropVar = new PROPVARIANT [nPidsi];
PROPSPEC *pDocPropSpec = new PROPSPEC [nPidsdi];
PROPVARIANT *pDocPropVar = new PROPVARIANT [nPidsdi];
for(INT i=0; i<nPidsi; i++) {
ZeroMemory(&pPropSpec[i], sizeof(PROPSPEC));
pPropSpec[i].ulKind = PRSPEC_PROPID;
pPropSpec[i].propid = pidsiArr[i].pid;
}
for(INT i=0; i<nPidsdi; i++) {
ZeroMemory(&pDocPropSpec[i], sizeof(PROPSPEC));
pDocPropSpec[i].ulKind = PRSPEC_PROPID;
pDocPropSpec[i].propid = pidsdiArr[i].pid;
}
// Obtain meta infos from FMTID_SummaryInformation
hr = pPropSetStg->Open(FMTID_SummaryInformation, STGM_READ | STGM_SHARE_EXCLUSIVE, &pPropStg);
// Read properties.
hr = pPropStg->ReadMultiple(nPidsi, pPropSpec, pPropVar);
if(FAILED(hr)) {
_tprintf(L"IPropertyStg::ReadMultiple() failed w/error %08lx",hr);
}
pPropStg->Release();
pPropStg = NULL;
// Obtain meta infos from FMTID_DocSummaryInformation
hr = pPropSetStg->Open(FMTID_DocSummaryInformation, STGM_READ | STGM_SHARE_EXCLUSIVE, &pPropStg);
// Read properties.
hr = pPropStg->ReadMultiple(nPidsdi, pDocPropSpec, pDocPropVar);
if(FAILED(hr)) {
_tprintf(L"IPropertyStg::ReadMultiple() failed w/error %08lx",hr);
}
pPropStg->Release();
// Copy Meta fields out from FMTID_SummaryInformation
for(int i = 0; i < nPidsi; i++) {
switch(pidsiArr[i].pid) {
case PIDSI_AUTHOR:
DumpPropVariant(pPropVar + i, m_wszAuthor, MAX_META_LEN);
break;
case PIDSI_TITLE:
DumpPropVariant(pPropVar + i, m_wszTitle, MAX_META_LEN);
break;
case PIDSI_SUBJECT:
DumpPropVariant(pPropVar + i, m_wszSubject, MAX_META_LEN);
break;
case PIDSI_KEYWORDS:
DumpPropVariant(pPropVar + i, m_wszKeywords, MAX_META_LEN);
break;
case PIDSI_APPNAME:
DumpPropVariant(pPropVar + i, m_wszApplication, MAX_META_LEN);