本文整理汇总了C++中LPSTORAGE::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ LPSTORAGE::QueryInterface方法的具体用法?C++ LPSTORAGE::QueryInterface怎么用?C++ LPSTORAGE::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPSTORAGE
的用法示例。
在下文中一共展示了LPSTORAGE::QueryInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........