Accessing Dynamic Properties in Microsoft Visual C++/#import
- Updated2025-07-23
- 1 minute(s) read
In Microsoft Visual C++, you can use the classes the #import directive generates to access dynamic properties by obtaining a PropertyObject reference from the specific object reference using the AsPropertyObject method on the object. You can use the PropertyObject interface to access custom properties of the object using a lookup string to specify the custom property.
The following code uses the PropertyObject.GetValString method to obtain the error message value for the current step:
void Example (LPDISPATCH seqContextDisp){
TS::SequenceContextPtr sequenceContext = seqContextDisp;
TS::PropertyObjectPtr property;
_bstr_t errorString;
property = sequenceContext->GetStep()->AsPropertyObject();
errorString = property->GetValString("Result.Error.Msg",0);
}