Thank you.


2014-04-30 1:13 GMT+08:00 Piotr Caban <piotr.caban@gmail.com>:
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.

 
Then I think this the same as return  VariantChangeType directly. How about writing like this:

if(res)
{
    V_VT(res) = VT_EMPTY;
    return VariantChangeType(res, arg, 0, VT_BOOL);
}
return S_OK;

Because whether the change succeed or not, VariantChangeType will return a value indicating the situation.

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.
I got it. I will do like this. Thank you.