If error reporting from MapWindowPoints is not sufficient to use it somewhere else you can always move its guts to
2012/10/24 Dmitry Timoshkov <dmitry@baikal.ru>
Christian Costa <titan.costa@gmail.com> wrote:As been said before these games with saving/restoring last error value
> BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
> {
> + DWORD error = GetLastError();
> +
> + if (!hwnd)
> + {
> + SetLastError( ERROR_INVALID_WINDOW_HANDLE );
> + return FALSE;
> + }
> +
> + SetLastError( 0xdeadbeef );
> MapWindowPoints( hwnd, 0, lppnt, 1 );
> +
> + if (GetLastError() != 0xdeadbeef)
> + return FALSE;
> +
> + SetLastError(error);
> return TRUE;
> }
are broken.
Last time you said wrong so what do you mean by wrong or broken?The only way to know if MapWindowPoints fails is to set last error first and check itafter. If I don't restore the previous value, the tests will not pass. Of course I canarrange the tests but hey. And I can check windows handle here as Alexandre said.