Ejemplo n.º 1
0
STDMETHODIMP CPropertyAction::GetSizeMax (ULARGE_INTEGER FAR* pcbSize)
{
char cbBuffer[_MAX_PATH];

	RETURN_FAILED_HRESULT(GetPropInfo (cbBuffer, sizeof(cbBuffer), NULL));
	LISet32(*pcbSize, 2*sizeof(DWORD)+sizeof(ULONG)+strlen(cbBuffer)+1);
	return S_OK;
}
Ejemplo n.º 2
0
STDMETHODIMP CPropertyActionBase::GetSizeMax (ULARGE_INTEGER FAR* pcbSize)
{
char cbBuffer[_MAX_PATH];
HRESULT  hr = GetPropInfo (cbBuffer, sizeof(cbBuffer), NULL);

	if (FAILED(hr)) return hr;

	LISet32(*pcbSize, strlen(cbBuffer)+1);

return NOERROR;
}
Ejemplo n.º 3
0
///////////////////////////////////////////////////////////////////////////////////////////////
// IPropertyAction methods
// PropertyPages einhängen
// diese Stelle wird bei DoActions() erreicht
STDMETHODIMP CRegOperatPropAct::AddConfigPages (LPFNADDPROPSHEETPAGE lpfnAddPage,
												LPARAM lParam, LPCSTR pcDesc, UINT *puiCnt)
{
char cbCaption[_MAX_PATH];

	try
	{
		if (NULL != pcDesc)		// Caption ist gegeben
			strcpy (cbCaption, pcDesc);
		else	// von zugehöriger ClassProperty unseren Namen besorgen
			GetPropInfo (cbCaption, sizeof(cbCaption), NULL);

		// zugehörigen ConfigDialog (PropertyPage(s)) anlegen
		DELETE_OBJ (m_pRegOperDlg);	// evtl. vorherigen freigeben
		m_pRegOperDlg = CRegardOperatDlg::CreateInstance (ResID(IDD_REGOPERATPROPACT, pRF),
														  cbCaption, this, m_caSelInfo, *pRF);
		if (NULL == m_pRegOperDlg) _com_issue_error (E_OUTOFMEMORY);

		if (!IsNoShow())
		{
		// Seite hinzufügen, wenn selbige angezeigt werden soll
		HPROPSHEETPAGE hPSP = m_pRegOperDlg -> CreatePage();

			if (NULL == hPSP) return E_HANDLE;
			if (!(*lpfnAddPage) (hPSP, lParam))
				return E_UNEXPECTED;
		}

		// Initialisierungsdaten für den Dialog wurden von Load() bereitgestellt, konnten aber
		// noch nicht an diesen weitergereicht werden
		if (m_bHasInitData)
		{
		// Initialisierungsdaten jetzt an den Dialog weiterreichen
		HRESULT	hr = m_pRegOperDlg->SetSelectedInfo (&m_caSelInfo, IsNoShow());

			if (FAILED(hr)) _com_issue_error(hr);
		}

		if (NULL != puiCnt) 
			*puiCnt = IsNoShow() ? 0 : 1;	// "1" ist die Anzahl der einzuhängenden Pages

	}
	catch (_com_error& e)
	{
		DELETE_OBJ (m_pRegOperDlg);
		if (puiCnt) *puiCnt = 0;
		return _COM_ERROR (e);
	}

	return S_OK;

} // AddConfigPages
Ejemplo n.º 4
0
/////////////////////////////////////////////////////////////////////////////
// IPropertyAction methods
STDMETHODIMP CTextSearchEngine::AddConfigPages (LPFNADDPROPSHEETPAGE lpfnAddPage, 
								LPARAM lParam, LPCSTR pcDesc, UINT *puiCnt)
{
char cbCaption[128];

	try {
		if (NULL != pcDesc)		// Caption ist gegeben
			strcpy (cbCaption, pcDesc);
		else	// von zugehöriger ClassProperty unseren Namen besorgen
			GetPropInfo (cbCaption, sizeof(cbCaption), NULL);

	// Kontext des Dialoges feststellen
	WClassProperty Cls;
	bool fChoice = false;

		if (SUCCEEDED(GetSite (IID_IClassProperty, Cls.ppv()))) {
		// Kontext ist entweder PropertyChoice oder PropertySequence 
		DWORD dwFlags = 0;

			if (SUCCEEDED(Cls -> GetPropInfo (NULL, 0, &dwFlags)))
				fChoice = (dwFlags & PROPCAPS_CONTAINER_IS_CHOICE) ? true : false;
		}

	// zugehörigen ConfigDialog (PropertyPage(s)) anlegen
	ResourceFile RF (g_pDLLName);
	UINT uiRes = fChoice ? IDD_TEXTSEARCHENGINE_CFGPP : IDD_TEXTSEARCHENGINE_CFG;

		DELETE_OBJ(m_pCfgDlg);	// evtl. vorherigen freigeben
		m_pCfgDlg = CCfgTextSearch::CreateInstance (this, 
						ResID (uiRes, &RF), cbCaption);
		if (NULL == m_pCfgDlg) _com_issue_error(E_OUTOFMEMORY);

	HPROPSHEETPAGE hPSP = this -> CreatePage(m_pCfgDlg);

		if (NULL == hPSP || !lpfnAddPage(hPSP, lParam))
			_com_issue_error(E_UNEXPECTED);

		if (puiCnt) *puiCnt = 1;

		m_pCfgDlg -> InitWithData (m_Status);

	} catch (_com_error& hr_result) {
		DELETE_OBJ (m_pCfgDlg);
		if (puiCnt) *puiCnt = 0;
		return _COM_ERROR(hr_result);
	}
	return S_OK;
}
Ejemplo n.º 5
0
// BasisKlasse schreib lediglich den Bezeichner weg 
STDMETHODIMP CPropertyActionBase::Save (LPSTREAM pStm, BOOL fClearDirty)
{
// Bezeichner wegschreiben
char cbBuffer[_MAX_PATH];
HRESULT hr = GetPropInfo (cbBuffer, sizeof(cbBuffer), NULL);

	if (FAILED(hr)) return hr;

ULONG ulLen = strlen(cbBuffer)+1;

	hr = pStm -> Write (&ulLen, sizeof(ULONG), NULL);
	if (FAILED(hr)) return hr;
	hr = pStm -> Write (cbBuffer, ulLen, NULL);
	if (FAILED(hr)) return hr;

return NOERROR;
}
Ejemplo n.º 6
0
// BasisKlasse schreibt lediglich den Bezeichner weg 
STDMETHODIMP CPropertyAction::Save (LPSTREAM pStm, BOOL fClearDirty)
{
// Versionsnummer wegschreiben
DWORD dwVersion = PROPACTB_VERSION_1_0_0;

	RETURN_FAILED_HRESULT(pStm -> Write (&dwVersion, sizeof(DWORD), NULL));
	
// Bezeichner wegschreiben
char cbBuffer[_MAX_PATH];
DWORD dwFlags = 0L;

	RETURN_FAILED_HRESULT(GetPropInfo (cbBuffer, sizeof(cbBuffer), &dwFlags));

ULONG ulLen = strlen(cbBuffer)+1;

	RETURN_FAILED_HRESULT(pStm -> Write (&ulLen, sizeof(ULONG), NULL));
	RETURN_FAILED_HRESULT(pStm -> Write (cbBuffer, ulLen, NULL));
	RETURN_FAILED_HRESULT(pStm -> Write (&dwFlags, sizeof(DWORD), NULL));
	return S_OK;
}