Click or drag to resize

LoByte Function

Return the low-order (rightmost) byte in a number.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION LoByte(
	wValue AS WORD
) AS BYTE
View Source

Parameters

wValue
Type: UInt16
The number whose low-order byte you want to get.

Return Value

Type: Byte
Remarks
Related data can be stored in the high-order and low-order words of a variable.  Therefore, instead of creating and returning a 2-element array, it may be more efficient to return a word whose 2 bytes contain separate information.
Examples
The Windows API function GetVersion() returns the DOS version in the high-order WORD and the Windows version in the low-order WORD.  Moreover, the DOS major number is in the high-order byte of its WORD, the DOS minor number is in the low-order bytes of its WORD, the Windows major number is in the low-order byte of its WORD, and the Windows minor number is in the high-order byte of its WORD:
X#
LOCAL dwVersion AS DWORD
LOCAL wDOS, wWindows AS DWORD
LOCAL bDOSMinor, bDOSMajor AS BYTE
LOCAL bWindowsMajor, bWindowsMinor AS BYTE
dwVersions := GetVersion()
wDOS :=  HiWord(dwVersions)
bDOSMajor := HiByte(wDOS)
bDOSMinor := LoByte(wDOS)
wWindows := LoWord(dwVersions)
bWindowsMinor := HiByte(wWindows)
bWindowsMajor := LoByte(wWindows)
? "The DOS major and minor numbers are",;
         bDOSMajor, bDOSMinor
// The DOS major and minor numbers are 5          0
? "The Windows major and minor numbers are",;
         bWindowsMajor, bWindowsMinor
// The Windows major and minor numbers are 3      10
See Also