I am relatively new to development within COM, and I was wondering what the community standard was for access of COM object properties. I have seen both of the following conventions in code:
comObjectPtr->PutValue(value);
and
comObjectPtr->Value = value;
and both seem to work, but I was wondering if there was an inherent advantage or disadvantage to either approach and why.
If I remember correctly, using the property assignment will throw an exception vs. a HRESULT returned in the setter if there is a problem.
Same thing is true of the getter method calls vs. property.
A ‘benefit’ of using the property is that you can use the prop-get values directly instead of having to declare a variable and getting it before using.