Results 1 to 4 of 4

Thread: HIWORD and LOWORD equilavents

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Question HIWORD and LOWORD equivalents

    I was looking through a C++ file and saw that to find the high-order bit of a value, like wParam or lParam, they used HIWORD and to find the low-order bit they used LOWORD.

    (At least, that's what I assume these functions do )

    I think to find the HIWORD - equivalent in VB you use &HFFFF (I'm not sure how many f's) but I don't know if this is what you use for the LOWORD, or it is the other way around or maybe you use

    God this is starting to sound like an Eminem single.

    Okay. How do you find the HIWORD and LOWORD of a value?
    Courgettes.

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Ireland, Dublin
    Posts
    76

    Talking

    I think this is what you are looking for.

    Hope it is of some help

    IJ



    Public Function HiWord(wParam As Long) As Integer

    If wParam And &H80000000 Then
    HiWord = (wParam \ 65535) - 1
    Else
    HiWord = wParam \ 65535
    End If

    End Function


    Public Function LoWord(wParam As Long) As Integer

    If wParam And &H8000& Then
    LoWord = &H8000 Or (wParam And &H7FFF&)
    Else
    LoWord = wParam And &HFFFF&
    End If

    End Function
    ---------------------------------
    TopMan
    ---------------------------------

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    BTW, HIWORD and LOWORD are macros (note the capital letters - instant giveaway), and you can get at the definitions (I think they're in winbase.h).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Red face

    macros, shmacros

    Thanks for the help.
    Courgettes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width