LoByte Function | |
Return the low-order (rightmost) byte in a number.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION LoByte(
wValue AS WORD
) AS BYTE
public static byte LoByte(
ushort wValue
)
Request Example
View SourceParameters
- wValue
- Type: Word
The number whose low-order byte you want to get.
Return Value
Type:
ByteRemarks
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:
1LOCAL dwVersion AS DWORD
2LOCAL wDOS, wWindows AS DWORD
3LOCAL bDOSMinor, bDOSMajor AS BYTE
4LOCAL bWindowsMajor, bWindowsMinor AS BYTE
5dwVersions := GetVersion()
6wDOS := HiWord(dwVersions)
7bDOSMajor := HiByte(wDOS)
8bDOSMinor := LoByte(wDOS)
9wWindows := LoWord(dwVersions)
10bWindowsMinor := HiByte(wWindows)
11bWindowsMajor := LoByte(wWindows)
12? "The DOS major and minor numbers are",;
13 bDOSMajor, bDOSMinor
14
15? "The Windows major and minor numbers are",;
16 bWindowsMajor, bWindowsMinor
17
See Also