Well, I just like to add my favorite version for now. It handles only ClientToScreen and ScreenToClient and fixes the return values. It doesn't touch MapWindowPoints and it doesn't check for the comment on msdn. I think those both extra points belong into separate patches. Feedback is welcome.
Cheers Rico
On 20.10.2012 22:58, Christian Costa wrote:
Ok. I'll add it. Thanks!
Le 20/10/2012 21:35, Rico Schüller a écrit :
I think we also need a test to prove that "return MapWindowPoints( hwnd, 0, lppnt, 1 ) != 0;" is wrong. I'd probably split the changes to ScreenToClient/ClientToScreen and MapWindowPoints, because they are not necessarily bound together.
What about something like: wnd2 = CreateWindow("static", "wnd2", WS_POPUP, 0, 0, 150, 150, NULL, NULL, NULL, NULL); ok(wnd2 != NULL, "CreateWindow failed\n"); SetLastError(0xdeadbeef); p.x = p.y = 0; ret = ScreenToClient(wnd2, &p); err = GetLastError(); ok(ret, "ScreenToClient() failed\n"); ok(p.x == 0 && p.y == 0, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 0, 0); ok(err == 0xdeadbeef, "GetLastError failed, got %x, expected %x\n", err, 0xdeadbeef);
Also msdn says: "Do not use ScreenToClient when in a mirroring situation, that is, when changing from left-to-right layout to right-to-left layout. Instead, use MapWindowPoints. For more information, see "Window Layout and Mirroring" in Window Features." We may also check that case. So they may not share the exact same steps.