<div dir="ltr">Thank you.<br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-30 1:13 GMT+08:00 Piotr Caban <span dir="ltr"><<a href="mailto:piotr.caban@gmail.com" target="_blank">piotr.caban@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 04/29/14 17:25, Shuai Meng wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
2014-04-29 22:25 GMT+08:00 Piotr Caban <<a href="mailto:piotr.caban@gmail.com" target="_blank">piotr.caban@gmail.com</a><br></div>
<mailto:<a href="mailto:piotr.caban@gmail.com" target="_blank">piotr.caban@gmail.com</a>><u></u>>:<div class=""><br>
    No, I mean that you should do something like this:<br>
    VARIANT v;<br>
    ...<br>
    V_VT(&v) = VT_EMPTY;<br>
    hr = VariantChangeType(..., &v);<br>
    if(FAILED(hr))<br>
         return hr;<br>
    ...<br>
<br>
    if(res)<br>
         *res = v;<br>
    else<br>
         VariantClear(&v);<br>
<br>
  what will be returned after  *res =  v; or VariantClear(&v); ?<br>
</div></blockquote>
S_OK, because the function has succeeded.<div class=""><br></div></blockquote><div> </div><div>Then I think this the same as return  VariantChangeType directly. How about writing like this:</div><div><br></div><div>if(res)</div>
<div>{</div><div>    V_VT(res) = VT_EMPTY;</div><div>    return VariantChangeType(res, arg, 0, VT_BOOL);</div><div>}</div><div>return S_OK;</div><div><br></div><div>Because whether the change succeed or not, VariantChangeType will return a value indicating the situation.</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
yes, I made a mistake. The error occurs when I test an empty string as<br>
Jacek have asked: <br>
477 Call ok(CBool("") = True, "CBool("""") = " & CBool(""))<br>
478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool("""")) = " &<br>
getVT(CBool("")))<br>
I have tried to solve it like this:<br>
477 Call ok(CBool("") = True, "CBool("") = " & CBool(""))<br>
478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool("")) = " &<br>
getVT(CBool("")))<br>
and this:<br>
477 Call ok(CBool("") = True, "CBool(" & "" & ") = " & CBool(""))<br>
478 Call ok(getVT(CBool("")) = "VT_BOOL", "getVT(CBool(" & "" & ")) = "<br>
& getVT(CBool("")))<br>
They all don't work...The problem is how describe an empty string<br>
between two quotation marks.<br>
</blockquote></div>
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.<br>
</blockquote></div>I got it. I will do like this. Thank you.</div></div>