Menu

#128 POINTSTOPOINT in WINUSER.H

closed-rejected
nobody
None
2002-09-05
2002-09-05
No

POINTSTOPOINT macro in WINUSER.H line 2445 should be:

#define POINTSTOPOINT(p,ps)
{(p).x=LOWORD(ps);(p).y=HIWORD(ps);}

Discussion

  • Danny Smith

    Danny Smith - 2002-09-05
    • status: open --> closed-rejected
     
  • Danny Smith

    Danny Smith - 2002-09-05

    Logged In: YES
    user_id=11494

    No it shouldn't. Try copying a POINTS to a POINT using
    you version eg:

    #include <windows.h>
    #include <stdio.h>

    #undef POINTSTOPOINT
    #define POINTSTOPOINT(p,ps) \
    {(p).x=LOWORD(ps);(p).y=HIWORD(ps);}

    int main(){

    POINTS pts = {1, 1};
    POINT pt = {0, 0};

    POINTSTOPOINT( pt, pts);

    printf ("%d\t%d", pt.x, pt.y);

    return 0;
    }

     
  • Gyorgy Horvath

    Gyorgy Horvath - 2002-09-06

    Logged In: YES
    user_id=606343

    The original I have downloaded looks:

    #define POINTSTOPOINT(p,ps)
    {(p).x=LOWORD(pts);(ps).y=HIWORD(ps);}

    What is pts? It is not in the Macro's argument list.
    Nevertheless, it simply cannot be compiled if I have not a
    "pts"
    declared in the scoipe of the given function invoking
    POINTSTOPOINT.

     
  • Danny Smith

    Danny Smith - 2002-09-06

    Logged In: YES
    user_id=11494

    You must have an old version of w32api.

    The current define is this:
    #define POINTSTOPOINT(p,ps) { \
    (p).x=LOWORD(*(DWORD *)&ps); \
    (p).y=HIWORD(*(DWORD *)&ps); \
    }

    That works.

    Your version
    #define POINTSTOPOINT(p,ps) \
    {(p).x=LOWORD(ps);(p).y=HIWORD(ps);}

    does not work.

    Before submitting a patch, please test it.

    Danny

     
MongoDB Logo MongoDB