PDA

Click to See Complete Forum and Search --> : HIWORD and LOWORD equilavents


V(ery) Basic
Aug 10th, 2000, 01:25 PM
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?

IrishJoker
Aug 10th, 2000, 02:33 PM
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

parksie
Aug 10th, 2000, 08:08 PM
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).

V(ery) Basic
Aug 11th, 2000, 08:21 AM
macros, shmacros

Thanks for the help.