HiCard, LoCard Functions

Purpose

Returns the high or low word in a Long expression. The expression is treated as unsigned.

Syntax

a% = HiCard(x%)

a% = LoCard(x%)

a%:16 bits unsigned integer
x%:32 bits integer expression

Description

HiCard returns the higher 16 bits and LoCard returns the lower 16 bits of a value as an unsigned 16-bit expression.

Example

Debug.Show

Local a As Int32 = MakeLong(12345, 678)

Trace HiCard(a)

Trace TypeName(HiCard(a))

Trace LoCard(a)

Trace TypeName(LoCard(a))

Trace Card(a)

The following example is written as a 16 bit GFA-BASIC for Windows program, only the declaration Local a| is new in. It opens a window and returns the scan code of a pressed function key.

OpenW # 1

Dim a|

Do

GetEvent

If MENU(11) = WM_KEYDOWN

a| = LoByte(HiCard(MENU(13)))

Text 0, 16, Str$(a|) + Space$(1000)

EndIf

Until MENU(1) = 4

CloseW # 1

Remarks

a% = HiCard(x%) is identical to a% = Card(Shr(x%,16)) and a% = LoCard(x%) is the same as a% = Card(x%), but the second expressions are compatible with the MS-DOS version of GFA-BASIC.

See Also

HiByte(), HiWord(), HiLarge(), LoByte(), LoCard(), LoWord(), LoLarge()

{Created by Sjouke Hamstra; Last updated: 09/10/2014 by James Gaite}