Click or drag to resize

HiWord Function

Return the high-order (leftmost) word in a number.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION HiWord(
	dwValue AS DWORD
) AS WORD
View Source

Parameters

dwValue
Type: UInt32
The number whose high-order word you want to get.

Return Value

Type: UInt16
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 double word whose 2 words contain separate information.  Also, many Windows API functions receive data in a LONGINT argument.  Usually the high-order and low-order words of this argument contain different information about a window and its messages.  HiWord() can be used to extract the high-order word of this argument.
Examples
This example applies HiWord() and LoWord() to a binary number.  It also displays the high-order and low-order portions of the binary number as 2 separate numbers:
X#
? HiWord(0b00001000100000011111111100001111)
                                                                //  2177
? LoWord(0b00001000100000011111111100001111)
                                                                // 65295
// High-order bits
? 0b0000100010000001                                //  2177
// Low-order bits
? 0b1111111100001111                                // 65295
See Also