I am starting to program using the windows GDI and am wondering what are LOWORD, HIWORD, lParam, and wParam?
I have seen them a lot but have no idea what they do.
Printable View
I am starting to program using the windows GDI and am wondering what are LOWORD, HIWORD, lParam, and wParam?
I have seen them a lot but have no idea what they do.
If you dont know what HIWORD and LOWORD do and you dont know what lParam, and wParam are then I dont think you should be trying to learn GDI, instead you should learn about the Win32 API.
Well, I know what a word is- a 16 bit unsifned integer, I know that HIWORD takes the high order word from a 32 bit value and LOWORD takes the lower order. I just don't understand what what the higher and lower order are.
Well the Win32 API uses bitpacking in the wParam and lParam to fit extra information about the message into the params passed to your WndProc. You extract this information using the HIWORD and LOWORD macros.
So does HIWORD acces the first half and LOWORD access the second half?
lParam:
(---------HIWORD --------)Message(---------LOWORD---------)
Here, direct from MSDN:
HIWORD:
LOWORD:Quote:
HIWORD
The HIWORD macro retrieves the high-order word from the given 32-bit value.
WORD HIWORD(
DWORD dwValue // value from which high-order word is retrieved
);
Parameters
dwValue
Specifies the value to be converted.
Return Values
The return value is the high-order word of the specified value.
Remarks
The HIWORD macro is defined as follows:
#define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF))
Quote:
LOWORD
The LOWORD macro retrieves the low-order word from the given 32-bit value.
WORD LOWORD(
DWORD dwValue // value from which low-order word is retrieved
);
Parameters
dwValue
Specifies the value to be converted.
Return Values
The return value is the low-order word of the specified value.
Remarks
The LOWORD macro is defined as follows:
#define LOWORD(l) ((WORD) (l))
thanx