Tony...
Quote:
>Is there any equivalent
>function to LOWORD/HIWORD in Visual Basic.
There are essentially two ways to do this -- with pure VB code, and with API
calls. I'll show both methods:
Pure VB:
Public Function LOWORD(lValue As Long) As Integer
If (lValue And &HFFFF&) > &H7FFF Then
LOWORD = (lValue And &HFFFF&) - &H10000
Else
LOWORD = lValue And &HFFFF&
End If
End Function
Public Function HIWORD(lValue As Long) As Integer
HIWORD = (lValue And &HFFFF0000) \ &H10000
End Function
With API:
Private Declare Sub CopyMemory Lib _
"kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, _
ByVal Length As Long)
Public Function LOWORD(ByVal LongIn As Long) As Integer
Call CopyMemory(LOWORD, LongIn, 2)
End Function
Public Function HIWORD(ByVal LongIn As Long) As Integer
Call CopyMemory(HIWORD, ByVal (VarPtr(LongIn) + 2), 2)
End Function
--
Ben Baird, MVP
Visual Basic Thunder
http://www.{*filter*}highway.com/~psy/vbthunder/
Common Controls Replacement Project
http://www.*-*-*.com/
Please direct your programming questions to the newsgroups.