Hi,
I'm trying to display a string in the property palette within a COM object (OPM wrapper). I tried a lot of codes, but cell remain empty. Here's my code:
idl:
[propget, id(1), helpstring("property name")] HRESULT name([out, retval] VARIANT *pVal);
wrapper header:
OPMPROP_ENTRY(0, 0x00001, PROPCAT_Misc, 0, 0, 0, _T(""), 0, 1, IID_NULL, IID_NULL, "")
STDMETHOD(get_name)(VARIANT * pVal);
wrapper implementation:
GetElementValue(...)
{
...
if(dispID == DISPID_PP_NAME)
{
CComVariant var;
get_name(&var);
BSTR str(var.bstrVal);
pVarOut->vt = VT_BSTR;
pVarOut->bstrVal = str;
return S_OK;
}
...
}
STDMETHODIMP get_name(VARIANT * pVal)
{
try
{
AcAxDocLock lock(m_objId);
if(lock.lockStatus())
return (E_ACCESSDENIED);
AcDbObjectPointer<BcModelViewportEntity> pModelViewport(m_objId, AcDb::kForRead);
if(pModelViewport.openStatus() != Acad::eOk)
return E_ACCESSDENIED;
CComBSTR str(L"HELLO WORLD");
str.CopyTo(pVal);
}
catch(const HRESULT hr)
{
Error(_T("An error occurred. Check the input params."));
return hr;
}
return S_OK;
}
Does anybody have a solution? Any suggestions are welcomed.
Regards,
Jonathan
--
Jonathan