Example #1
0
// Erzeugen und initialisieren eines PropertyActionChoice-Objektes, welches die
// vorgegebenen PropertyActions enthält
HRESULT InitPropertyActionChoice (
	LPCSTR pcDesc, CALPCLSID *pcaClsIds, IPropertyActionSequence **ppISeq)
{
	USES_CONVERSION;

	if (NULL == ppISeq) return E_POINTER;
	*ppISeq = NULL;		// für alle Fälle

WPropertyActionSequence ISeq;
HRESULT hr = E_FAIL;
WStorage IStg;

	GetSubPropSeqStorage (IStg.ppi());
	if (NULL != (IStorage *)IStg) {	// evtl. gespeicherten Status laden
	WStream IStm;
	string strName = MakeStreamName(pcDesc);

	// Stream erzeugen
		hr = IStg -> OpenStream (A2OLE(strName.c_str()), NULL, 
						STGM_READ|STGM_SHARE_EXCLUSIVE, 0L, IStm.ppi());

		if (SUCCEEDED(hr)) {
			hr = OleLoadFromStream (IStm, IID_IPropertyActionSequence, ISeq.ppv());
			if (SUCCEEDED(hr)) {
				*ppISeq = ISeq.detach();
				return S_OK;
			}
		}
	}
	
// wenn Status nicht geladen werden kann, dann neu initialisieren
	try {
	// Objekt erzeugen
		ISeq = WPropertyActionSequence (CLSID_PropertyChoice);		// throws hr
		ISeq -> SetDescription (pcDesc);

	// Rücksetzen der AktionsFolge
	WPersistStreamInit Init = ISeq;		// throws hr

		hr = Init -> InitNew();
		if (FAILED(hr)) _com_issue_error(hr);
	
	} catch (_com_error& hr) {
		return _COM_ERROR(hr);
	}

// hinzufügen der einzelnen Aktionen
	hr = ISeq -> AddActionsByCLSID (pcaClsIds);
	if (FAILED(hr)) return hr;

	*ppISeq = ISeq.detach();

return NOERROR;
}
Example #2
0
// ----------------------------------------------------------------------------
// PropertySequence_refcnt
// ----------------------------------------------------------------------------
void PropertySequence_refcnt (ebHTHREAD hThread, int iNumArgs, ebARGS lpArgs)
{
	BASIC_OP_TRACE_SYS(PropertySequence_refcnt);
	switch (iNumArgs) {
	case OBJECT_REFNEW:
		{
			ebSetObject (lpArgs, 0, NULL);		// für alle Fälle
			try {
			WPropertyActionSequence PropSeq (CLSID_PropertyActionSequence);		// throws hr
			HPROJECT hPrCtx = reinterpret_cast<HPROJECT>(ebThread_GetLong (hThread, SETLONG_HPROJECT));		// Kontext-Datenquelle

				ebSetObject (lpArgs, 0, (DWORD)PropSeq.detach());
				if (HACTCONNECTION != hPrCtx) {
				WDataObject CtxDO;
				CComVariant vData (reinterpret_cast<long>(hPrCtx), VT_I4);

					THROW_FAILED_HRESULT(PropSeq -> GetSequenceContext (CtxDO.ppi()));
					THROW_FAILED_HRESULT(SetVariantData (vData, CtxDO, &c_feDataSourceHandle));
				}

			} catch (...) {
				TRACE("Couldn't instantiate PropertyActionSequence\r\n");
			}
		}
		break;
		
	case OBJECT_REFINC:
		((IUnknown *)ebGetObject(lpArgs, 1)) -> AddRef();
		break;
		
	case OBJECT_REFDEC:
		((IUnknown *)ebGetObject(lpArgs, 1)) -> Release();
		break;
	}
}
Example #3
0
// Laden einer bestimmten PropertySequence
	HRESULT LoadPropertySequence (BSTR bstrName, IPropertyActionSequence **ppIPropertyActionSequence)
	{
		TEST_OUT_PARAM(ppIPropertyActionSequence);
		COM_TRY {
		WStorage Stg;

			if (FAILED(OpenPropSeqStorage (STGM_READ, Stg.ppi())))
				return E_FAIL;

		CComBSTR bstrStreamName;
		WStream	Strm;

			THROW_FAILED_HRESULT(MakeStreamName(bstrName, bstrStreamName));
			if (FAILED(Stg -> OpenStream (bstrStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, Strm.ppi())))
				return E_FAIL;

		WPropertyActionSequence	Seq;

			THROW_FAILED_HRESULT(::OleLoadFromStream (Strm, Seq.GetIID(), Seq.ppv()));
			*ppIPropertyActionSequence = Seq.detach();

		} COM_CATCH;
		return S_OK;
	}