Hi!
I'm working on some conversion stuff, and would like to know why this isn't working with negative values. The following 2 Functions are from microsoft themselves and are functional & tested (by me...):
So I tried to put them back together, but keep getting overflows with negative values...Code:Public Function HiByte(ByVal wParam As Integer) As Byte HiByte = wParam \ &H100 And &HFF& End Function Public Function LoByte(ByVal wParam As Integer) As Byte LoByte = wParam And &HFF& End Function
Does anyone know jow to correctly do this? (Please test this/your code before replying)Code:Public Function Bytes2Word(ByVal bHiByte As Byte, ByVal bLoByte As Byte) As Integer Bytes2Word = (bHiByte * &H100) Or (bLoByte And &HFF&) End Function




Reply With Quote