• 03-25-2002
incognito
What does this mean?

int x=LOWORD(lparam); //x is contained in the lower 16 bits
int y=HIWORD(lparam);//y is contained in the upper 16 bits

Ok what does LOWORD and HIGHWORD mean? I mean I know it retreives x and y but I don't really know the meaning of LOWORD and HIGHWORD.....please explain......
• 03-25-2002
RobR
Picture a 32 bit binary number, for example

Code:

```1011010010100101  0100101001010010     High word      Low word```
Clear??
• 03-25-2002
GodLike
if it in the WM_MOUSEMOVE

it means
that int x is the x of the mouse pointer
an int y is the y of the muse pointer
• 03-25-2002
incognito
But what would the difference be when doing this?

int x=LOWORD(lparam); //x is contained in the lower 16 bits
int y=HIWORD(lparam);//y is contained in the upper 16 bits

or would it work if I were to invert them like so

int x=HIWORD(lparam); //x is contained in the lower 16 bits
int y=LOWORD(lparam);//y is contained in the upper 16 bits
• 03-25-2002
incognito
Quote:

Originally posted by RobR
Picture a 32 bit binary number, for example

Code:

```1011010010100101  0100101001010010     High word      Low word```
Clear??

How would that make a different which you would call it from either High word or Low word?
• 03-25-2002
Fordy
OK......look at it like so....

lParam is a 32bit value......just like an int.......

Now remember that a byte is a collection of 8 binary bits.....each of which can represent a '1' or a '0'......

So a 32bit value can represent 4 bytes (32bit / 8 bits per bytes) or 4 collections of 8bits.....like so

10110100 01111010 11111000 00001101

Notice how each is 8 bits long.....

Now with the whole LOWORD/HIWORD.....you are only looking at either the first 16bits (2 bytes) or the last 16bits....so 2 16bit values can be stores in 1 32bit value.....
• 03-25-2002
incognito
Quote:

Originally posted by Fordy
OK......look at it like so....

lParam is a 32bit value......just like an int.......

Now remember that a byte is a collection of 8 binary bits.....each of which can represent a '1' or a '0'......

So a 32bit value can represent 4 bytes (32bit / 8 bits per bytes) or 4 collections of 8bits.....like so

10110100 01111010 11111000 00001101

Notice how each is 8 bits long.....

Now with the whole LOWORD/HIWORD.....you are only looking at either the first 16bits (2 bytes) or the last 16bits....so 2 16bit values can be stores in 1 32bit value.....

Ok, I am not sure I follow you though we split the values of X and Y into 32 bits or something? Let's say X int the first 16 bits and the y in the second 16 bits? If I am wrong please clarify, if I am right however (doubtful) could you use HIWORD for Y and LOWORD for X.?
• 03-25-2002
Fordy
Quote:

Originally posted by elchulo2002

Ok, I am not sure I follow you though we split the values of X and Y into 32 bits or something? Let's say X int the first 16 bits and the y in the second 16 bits? If I am wrong please clarify, if I am right however (doubtful) could you use HIWORD for Y and LOWORD for X.?

Yeah.....the value is 32bit....so that can be seperated into 2 16bit values (x & y)......

These actual 16bit values are WORDs..... you are assigning them to ints..but as ints are bigger than WORDs....you are ok