RE: extracting mouse coordinate

From: Paul (Paul_at_discussions.microsoft.com)
Date: 10/07/04


Date: Thu, 7 Oct 2004 14:45:01 -0700

Cool!

Btw, what you meant was AND bit operation, right? So, the first short is
always Y coordinate and second short is always X coordinate, correct?

-P

"Alex K" wrote:

> I'll give this a try...
>
> The lparam of the message is an int which is 32bits. The x and y are stored
> as short which is 16bits. Because the API was limited to how many parameters
> are being passed you can the two short glued together when you get them.
>
> What the code does is this:
> - using the OR logic it removes the first short and leaves you with the
> second short that you can use.
> - the second one works almost the same way. it removes the second short
> leaving the first short. however the result is that the useful bits are in
> the higher part of the int so you have to shift them down and then convert it
> to a short.