Le 20/10/2012 03:59, Dmitry Timoshkov a écrit :
Christian Costa <[email protected]> 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.

I'm not it is wrong but I can do certainly do it differently.


Reply via email to