Hi,
I implemented OPM wrapper for my custom entity and I overrided the method GetDisplayName to specify custom properties names and a custom display name like this:
STDMETHODIMP CCustomWrapper::GetDisplayName(DISPID dispId, BSTR * propName) { HRESULT hr = S_OK; switch(dispId) { case DISPID_...: *propName = ::SysAllocString(_T("My property")); break; case DISPID_DISPLAYNAME: *propName = ::SysAllocString(_T("MyCustomEntity")); break; default: hr = IOPMPropertyExtensionImpl<CCustomWrapper>::GetDisplayName(dispId, propName); assert(hr == S_OK); } return hr; }
The problem is that the call to IOPMPropertyExtensionImpl<CCustomWrapper>::GetDisplayName(dispId, propName); always returns E_FAIL. The result is that the name of each common properties of AcDbEntities is not correct. See the images below:
What did I do wrong? In the ObjectARX samples, no call to the parent IOPMPropertyExtensionImpl is made...
Regards,
Jonathan
Solved! Go to Solution.
Solved by owenwengerd. Go to Solution.
As far as I know, the only solution is to create a separate wrapper instance (I create one of the base class entity type), then call it's GetDisplayName member function.
CComQIPtr<IOPMPropertyExtension> OPEHelper; OPEHelper.CoCreateInstance( CLSID_AcadLine ); if (dispID >= 0x100 && OPEHelper) { hr = OPEHelper->GetDisplayName(dispID, propName); if (SUCCEEDED(hr)) return S_OK; } hr = __super::GetDisplayName(dispID, propName);
Hi Owen,
Thank you for your answer. Your solution works.
Maybe there is a easier (lighter) solution?
Regards,
Jonathan