<br><br><div class="gmail_quote">2012/10/24 Dmitry Timoshkov <span dir="ltr"><<a href="mailto:dmitry@baikal.ru" target="_blank">dmitry@baikal.ru</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Christian Costa <<a href="mailto:titan.costa@gmail.com">titan.costa@gmail.com</a>> wrote:<br>
<br>
>  BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )<br>
>  {<br>
> +    DWORD error = GetLastError();<br>
> +<br>
> +    if (!hwnd)<br>
> +    {<br>
> +        SetLastError( ERROR_INVALID_WINDOW_HANDLE );<br>
> +        return FALSE;<br>
> +    }<br>
> +<br>
> +    SetLastError( 0xdeadbeef );<br>
>      MapWindowPoints( hwnd, 0, lppnt, 1 );<br>
> +<br>
> +    if (GetLastError() != 0xdeadbeef)<br>
> +        return FALSE;<br>
> +<br>
> +    SetLastError(error);<br>
>      return TRUE;<br>
>  }<br>
<br>
</div>As been said before these games with saving/restoring last error value<br>
are broken.<br>
<span class="HOEnZb"><font color="#888888"><br><br></font></span></blockquote><div>Last time you said wrong so what do you mean by wrong or broken?</div><div>The only way to know if MapWindowPoints fails is to set last error first and check it</div>
<div>after. If I don't restore the previous value, the tests will not pass. Of course I can</div><div>arrange the tests but hey. And I can check windows handle here as Alexandre said.</div></div><br>