Returns the HiWord (the most significant 2 bytes) from a 4-byte DoubleWord (aka Long).
Code
HiWord01
Public Function HiWord01(lDWord As Long) As Integer
HiWord01 = (lDWord And &HFFFF0000) \ &H10000
End Function
HiWord02
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Public Function HiWord02(lDWord As Long) As Integer
CopyMemory HiWord02, ByVal VarPtr(lDWord) + 2&, 2&
End Function