19 Oct
2012
19 Oct
'12
8:59 p.m.
Christian Costa <titan.costa(a)gmail.com> wrote:
-BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt ) +BOOL WINAPI ClientToScreen( HWND wnd, LPPOINT point ) { - MapWindowPoints( hwnd, 0, lppnt, 1 ); + DWORD error = GetLastError(); + + if (!wnd) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return FALSE; + } + + SetLastError( 0xdeadbeef ); + MapWindowPoints( wnd, 0, point, 1 ); + + if (GetLastError() != 0xdeadbeef) + return FALSE; + + SetLastError(error); return TRUE; }
All this logic with saving/restoring last error code is wrong (here and in another places), there is no need for that. -- Dmitry.