Article ID: 112651
Article Last Modified on 12/9/2003
Sub Command1_Click ()
Dim wParam As Integer
Dim LOBYTE As Integer
Dim HIBYTE As Integer
' Set wParam to a value:
wParam = &H77FF
' Make call to function:
ret = gethilobyte(wParam, LOBYTE, HIBYTE)
' Print out return values:
Print LOBYTE, HIBYTE
End Sub
Sub Command2_Click ()
Dim lParam As Long
Dim LOWORD As Long
Dim HIWORD As Long
' Set lParam to a value:
lParam = &H7777FFFF
' Make call to function:
ret = gethiloword(lParam, LOWORD, HIWORD)
' Print out return values:
Print LOWORD, HIWORD
End Sub
' Enter the following Function statement as one, single line:
Function gethilobyte(wparam as integer, LOBYTE as integer,
HIBYTE as integer)
' This is the LOBYTE of the wParam:
LOBYTE = wParam And &HFF&
' This is the HIBYTE of the wParam:
HIBYTE = wParam \ &H100 And &HFF&
gethilobyte = 1
End Function
Function gethiloword(lparam as long, LOWORD as long, HIWORD as long)
' This is the LOWORD of the lParam:
LOWORD = lParam And &HFFFF&
' LOWORD now equals 65,535 or &HFFFF
' This is the HIWORD of the lParam:
HIWORD = lParam \ &H10000 And &HFFFF&
' HIWORD now equals 30,583 or &H7777
gethiloword = 1
End Function
Additional query words: 2.00 3.00
Keywords: KB112651