<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-09-19 19:52 GMT+08:00 Shuai Meng <span dir="ltr"><<a href="mailto:mengshuaicalendr@gmail.com" target="_blank">mengshuaicalendr@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for commenting~<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2014-09-19 2:09 GMT+08:00 Nikolay Sivov <span dir="ltr"><<a href="mailto:nsivov@codeweavers.com" target="_blank">nsivov@codeweavers.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"><br>
<br>
On 09/18/2014 08:46 PM, Shuai Meng wrote:<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">
+    LONG total, color[3];//color[0] for red, color[1] for green, color[2] for blue.<br>
</blockquote>
<br>
This could be just 'int', as you use to_int().<br>
<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">
  static HRESULT return_int(VARIANT *res, int val)<br>
  {<br>
-    if((short)val == val)<br>
-        return return_short(res, val);<br>
-<br>
</blockquote>
<br>
That's a questionable thing to do as it affects all other places where this helper is used.<br></blockquote></span><div>You are right, but I will check that whether all the functions who call to_int() use these codes, I think these are unnecessary, cause we should use to_int and to_short seperately in order to get return values of different types, i.e. VT_I2 and VT_I4, especially for the smaller numbers such as 0. </div><span class=""><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">
<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">
+        if(color[i] > 255)<br>
+            color[i] = 255;<br>
</blockquote>
<br>
This needs a test too.<br>
<br></blockquote></span><div>Yeah, good idea. </div><span class=""><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">
<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">
+    total = color[0] + 256 * color[1] + 256 * 256 * color[2];<br>
</blockquote>
<br>
RGB() macro does the same thing.<br>
<br></blockquote></span><div>I don't quite understand this line..will you explain it in detail please? </div></div></div></div></blockquote><div>OK, forgive my poor English, I know what "macro" means. </div></div><br></div></div>