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


C++ IPropertyStorage类代码示例

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


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

示例1: GetI

// @pymethod |PyIPropertyStorage|DeletePropertyNames|Removes property names from specified properties.
PyObject *PyIPropertyStorage::DeletePropertyNames(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:DeletePropertyNames", &obProps))
		return NULL;

	ULONG cProps;
	PROPID *pProps;
	if (!PyObject_AsPROPIDs( obProps, &pProps, &cProps))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIPS->DeletePropertyNames( cProps, pProps );
	PY_INTERFACE_POSTCALL;
	PyObject_FreePROPIDs(pProps, cProps);
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
	Py_INCREF(Py_None);
	return Py_None;

}
开发者ID:malrsrch,项目名称:pywin32,代码行数:26,代码来源:PyIPropertyStorage.cpp

示例2: spPropertySetStorage

void OleProperties::DeleteProperty(unsigned long id)
{
	IPropertySetStoragePtr spPropertySetStorage(m_pStorage.GetInternalObject());

	IPropertyStorage* pPropertyStorage = 0;
	HRESULT hr = spPropertySetStorage->Open(FMTID_UserDefinedProperties, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropertyStorage);
	if(STG_E_FILENOTFOUND == hr)
		return;
	
	IPropertyStoragePtr spPropertyStorage(pPropertyStorage, false);

	PROPSPEC propSpec;
	ZeroMemory(&propSpec, sizeof(PROPSPEC));
	propSpec.ulKind = PRSPEC_PROPID;
	propSpec.propid = id;

	hr = pPropertyStorage->DeleteMultiple(1, &propSpec);
	if(FAILED(hr))
		ThrowComException(L"Failed to delete the property values", hr);

	hr = pPropertyStorage->DeletePropertyNames(1, &propSpec.propid);
	if(FAILED(hr))
		ThrowComException(L"Failed to delete the property name", hr);

	hr = spPropertyStorage->Commit(STGC_OVERWRITE);
	if(FAILED(hr))
		ThrowComException(L"Failed to persist the changes", hr);
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:28,代码来源:OleProperties.cpp

示例3: 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;
//.........这里部分代码省略.........
开发者ID:vasilenkomike,项目名称:xray,代码行数:101,代码来源:showpropdlg.cpp

示例4: CreateUrl

/******************************************************************
 CreateUrl - Creates a shortcut via IUniformResourceLocatorW

*******************************************************************/
static HRESULT CreateUrl(
    __in_z LPCWSTR wzTarget,
    __in_z LPCWSTR wzShortcutPath,
    __in_z_opt LPCWSTR wzIconPath,
    __in int iconIndex
)
{
    HRESULT hr = S_OK;
    IUniformResourceLocatorW* piURL = NULL;
    IPersistFile* piPersistFile = NULL;
    IPropertySetStorage* piProperties = NULL;
    IPropertyStorage* piStorage = NULL;

    // create an internet shortcut object
    WcaLog(LOGMSG_STANDARD, "Creating IUniformResourceLocatorW shortcut '%ls' target '%ls'", wzShortcutPath, wzTarget);
    hr = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_ALL, IID_IUniformResourceLocatorW, (void**)&piURL);
    ExitOnFailure(hr, "failed to create an instance of IUniformResourceLocatorW");

    // set shortcut target
    hr = piURL->SetURL(wzTarget, 0);
    ExitOnFailure2(hr, "failed to set shortcut '%ls' target '%ls'", wzShortcutPath, wzTarget);

    if (wzIconPath)
    {
        hr = piURL->QueryInterface(IID_IPropertySetStorage, (void **)&piProperties);
        ExitOnFailure1(hr, "failed to get IPropertySetStorage for shortcut '%ls'", wzShortcutPath);

        hr = piProperties->Open(FMTID_Intshcut, STGM_WRITE, &piStorage);
        ExitOnFailure1(hr, "failed to open storage for shortcut '%ls'", wzShortcutPath);

        PROPSPEC ppids[2] = { {PRSPEC_PROPID, PID_IS_ICONINDEX}, {PRSPEC_PROPID, PID_IS_ICONFILE} };
        PROPVARIANT ppvar[2];

        PropVariantInit(ppvar);
        PropVariantInit(ppvar + 1);

        ppvar[0].vt = VT_I4;
        ppvar[0].lVal = iconIndex;
        ppvar[1].vt = VT_LPWSTR;
        ppvar[1].pwszVal = (LPWSTR)wzIconPath;

        hr = piStorage->WriteMultiple(2, ppids, ppvar, 0);
        ExitOnFailure1(hr, "failed to write icon storage for shortcut '%ls'", wzShortcutPath);

        hr = piStorage->Commit(STGC_DEFAULT);
        ExitOnFailure1(hr, "failed to commit icon storage for shortcut '%ls'", wzShortcutPath);
    }

    // get an IPersistFile and save the shortcut
    hr = piURL->QueryInterface(IID_IPersistFile, (void**)&piPersistFile);
    ExitOnFailure1(hr, "failed to get IPersistFile for shortcut '%ls'", wzShortcutPath);

    hr = piPersistFile->Save(wzShortcutPath, TRUE);
    ExitOnFailure1(hr, "failed to save shortcut '%ls'", wzShortcutPath);

LExit:
    ReleaseObject(piPersistFile);
    ReleaseObject(piURL);
    ReleaseObject(piStorage);
    ReleaseObject(piProperties);

    return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:67,代码来源:netshortcuts.cpp

示例5: _tprintf


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

		UINT nLength = aOffsets[i + 1] - aOffsets[i];
		pieceEnd = pieceStart + nLength * (bUnicode ? 2 : 1);

		liTmpSeek.QuadPart = pieceStart;
		hr = pStream->Seek(liTmpSeek, 0, NULL);
		//m_wszContent += ReadString(documentReader, pieceEnd - pieceStart, isUnicode);
		if (nLength == 0)
			continue;

		for (UINT i = 0; i < nLength; i++)
		{
			if (!bUnicode)
			{
				BYTE ch = 0;
				pStream->Read(&ch, 1, NULL);
				m_wszContent += (CHAR)ch;
			}
			else
			{
				SHORT ch = 0;
				pStream->Read(&ch, 2, NULL);
				m_wszContent += (WCHAR)ch;
			}	
		}
	}
	pStream->Release();
	pTableStream->Release();

#endif

	// Obtain the IPropertySetStorage interface.
	hr = pStorage->QueryInterface(IID_IPropertySetStorage, (void **)&pPropSetStg);
	IPropertyStorage *pPropStg = NULL;

	struct pidsiStruct {
		TCHAR *name;
		LONG pid;
	} pidsiArr[] = {
		{L"Author",           PIDSI_AUTHOR},
		{L"Title",            PIDSI_TITLE},
		{L"Subject",          PIDSI_SUBJECT},
		{L"Keywords",         PIDSI_KEYWORDS},
		{L"Status",			  PIDMSI_STATUS},
		{L"AppName",          PIDSI_APPNAME}, 
		{L"Comments",         PIDSI_COMMENTS},
		{L"Template",         PIDSI_TEMPLATE},
		{L"Revision Number",  PIDSI_REVNUMBER},
		{L"Created",          PIDSI_CREATE_DTM},
		{L"Edit Time",        PIDSI_EDITTIME},
		{L"Last Saved",       PIDSI_LASTSAVE_DTM},
		{L"LastAuthor",       PIDSI_LASTAUTHOR},
		{L"Last printed",     PIDSI_LASTPRINTED},
		{L"Page Count",       PIDSI_PAGECOUNT},
		{L"Word Count",       PIDSI_WORDCOUNT},
		{L"Char Count",       PIDSI_CHARCOUNT},
		{L"Thumbnail",        PIDSI_THUMBNAIL},
		{L"Doc Security",     PIDSI_DOC_SECURITY},
		{0, 0}
	}, pidsdiArr[] = {
		{L"Company",		  PIDDSI_COMPANY},
		{L"Slide notes",      PIDDSI_SLIDECOUNT},
		{0, 0}
	};
	
	// Count elements in pidsiArr.
开发者ID:jason5001001,项目名称:dataextractor,代码行数:67,代码来源:DocFile.cpp


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