Modify File Property Example

.h

 

HRESULT ModifyProperty(SolidEdgeDocumentPtr document, bstr_t propertySetName, bstr_t propertyName, variant_t value);

 

 

.cpp

 

HRESULT ModifyProperty(SolidEdgeDocumentPtr document, bstr_t propertySetName, bstr_t propertyName, variant_t value)

{

HRESULT hr = S_OK;

 

if (document != NULL)

{

try

{

PropertySetsPtr pPropertySets = document->Properties;

PropertiesPtr pProperties = pPropertySets->Item(propertySetName);

PropertyPtr pProperty = NULL;

 

try

{

pProperty = pProperties->Item(propertyName);

pProperty->PutValue(&value);

}

catch(_com_error &e)

{

hr = e.Error();

}

}

catch(_com_error &e)

{

_bstr_t desc = e.Description();

hr = e.Error();

}

}

else

{

hr = E_INVALIDARG;

}

 

return hr;

}

 

 

Example Usage

 

CString strRMSize(_T("Example Value"));

SolidEdgeDocumentPtr pDocument = this->m_pApplication->ActiveDocument;

hr = ::ModifyProperty(pDocument, "Custom", "RMSize", _variant_t(strRMSize));

 

 

Posted by: Jason Newell
Post date: 8/10/2006 5:28:01 AM

1 REPLY

RE: Modify File Property Example

Thanks Jason

 

Posted by: Calum McLellan
Post date: 8/10/2006 9:18:54 AM