GetPhaseInfo is defined as following:
GetPhaseInfo(BSTR phaseLabel, BSTR phaseAttribute, VARIANT * value);
where when phaseAttribute is 'StateOfAggregation', 'Vapor' or 'Liquid' or 'Solid' will be returned as string.
I have finished one Property Package, and tested in COFE environment, the following codes are wrong:
====== C++ codes start =============
CVaraint v;
v.MakeArray(1,VT_BSTR);
if(phase==_T("Vapor")) v.AllocStringAt(0,_T("Vapor"));
else if.......
......;
*value=v.ReturnValue();
return S_OK;
====== C++ codes end =============
COFE shows that:
"error: GetPhaseInfo() failed for phase Vapor: Failed to get state of aggregation, string value expected"
Then I changed the codes into the following:
====== C++ codes start =============
CVaraint v;
if(phase==_T("Vapor")) v.bstrVal=CBSTR(_T("Vapor"));
else if.......
......;
*value=v.ReturnValue();
return S_OK;
====== C++ codes end =============
The error tip of COFE still exists.
So I am not sure which VARIANT type of 'value' should I return?