Exemplo n.º 1
0
// --------------------------------------------------------------------------------------------
STDMETHODIMP CRegOperatPropAct::BeginAction (IProgressIndicator* pIProgInd)
{
#if _TRiAS_VER < 0x0300
	m_hPr = 0;
#else
	COM_TRY
	{
	// Zieldatenquelle aus KontextObjekt herausfinden
	WPropertyActionSequence wSeq;
	WDataObject CtxDO;
	CComVariant vData;

		m_hPr = 0;

		THROW_FAILED_HRESULT (GetSite (IID_IPropertyActionSequence, wSeq.ppv()));
		THROW_FAILED_HRESULT (wSeq->GetSequenceContext (CtxDO.ppi()));
		if (SUCCEEDED (GetVariantData (CtxDO, &c_feDataSourceHandle, &vData)) &&
			SUCCEEDED (vData.ChangeType (VT_I4))) 
		{
			m_hPr = reinterpret_cast<HPROJECT>(V_I4(&vData));
		}
	}
	COM_CATCH;
#endif // _TRiAS_VER < 0x0300

	// Zustand des Dialogs retten (für evtl. späteres Save())
	m_pRegOperDlg->GetSelectedInfo (&m_caSelInfo, m_bIsDirty);

	// Liste für Objekte, die an die PropertyPage übergeben werden, initialisieren
	m_InObjs.clear();				// Liste sicher leeren
	m_ObjsIter = m_InObjs.begin();	// auf Anfang stellen

	return S_OK;

} // BeginAction
Exemplo n.º 2
0
STDMETHODIMP CPropertyChoice::GetSequenceContext (IDataObject **ppIData)
{
WPropertyActionSequence Seq;

	if (SUCCEEDED(GetSite (IID_IPropertyActionSequence, Seq.ppv())) && Seq.IsValid())
		return Seq -> GetSequenceContext (ppIData);
	return E_UNEXPECTED;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
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;
	}