On 04/29/14 17:25, Shuai Meng wrote:
2014-04-29 22:25 GMT+08:00 Piotr Caban <piotr.caban@gmail.com mailto:piotr.caban@gmail.com>: No, I mean that you should do something like this: VARIANT v; ... V_VT(&v) = VT_EMPTY; hr = VariantChangeType(..., &v); if(FAILED(hr)) return hr; ...
if(res) *res = v; else VariantClear(&v);
what will be returned after *res = v; or VariantClear(&v); ?
S_OK, because the function has succeeded.
yes, I made a mistake. The error occurs when I test an empty string as Jacek have asked: 477 Call ok(CBool("") = True, "CBool("""") = " & CBool("")) 478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool("""")) = " & getVT(CBool(""))) I have tried to solve it like this: 477 Call ok(CBool("") = True, "CBool("") = " & CBool("")) 478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool("")) = " & getVT(CBool(""))) and this: 477 Call ok(CBool("") = True, "CBool(" & "" & ") = " & CBool("")) 478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool(" & "" & ")) = " & getVT(CBool(""))) They all don't work...The problem is how describe an empty string between two quotation marks.
It's ok to use "" for empty string. The CBool is simply failing for that argument. It can be tested in similar way as "#FALSE# string.