Thread: LOWORD,HIWORD,lParam,etc...

  1. #1

    Question LOWORD,HIWORD,lParam,etc...

    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.

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    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.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #3

    Post ....

    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.

  4. #4
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    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.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  5. #5

    Post ok

    So does HIWORD acces the first half and LOWORD access the second half?

    lParam:

    (---------HIWORD --------)Message(---------LOWORD---------)

  6. #6
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Here, direct from MSDN:
    HIWORD:
    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))
    LOWORD:
    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))
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  7. #7

    Post thanx

    thanx

Popular pages Recent additions subscribe to a feed