HiWord and LoWord Functions

The program demonstrates using the HiWord and LoWord functions to store a screen location in a single uinteger.

'HiWord and LoWord Functions
'Demonstrates using the HiWord and LoWord functions.
'****************************************************

'Macro created by v1ctor
#define MAKDWORD(x,y) (cint(x) shl 16 or cint(y))

Dim myInt As Uinteger
Dim As Integer i, cnt

'Store row 5 column 5 in a single uinteger
myInt = MAKDWORD(5, 5)

'Set the width and height of the console window
Width 80, 25
'Print column headers
cnt = 1
For i = 1 To 80
    'Print columns as 12345678901...
    If cnt = 10 Then
        cnt = 0
    End If
    Locate 1, i
    'Convert to string so we don't get leading space
    Print Str(cnt)
    'Increment our counter
    cnt += 1
Next
'Print row headers
cnt = 2
For i = 2 To 25
    'Row numbers will be like col numbers
    If cnt = 10 Then
        cnt = 0
    End If
    Locate i, 1
    'Convert to string so we don't get leading space
    'We need the semi-colon so a line feed isn't printed
    'on line 25 which would scroll screen.
    Print Str(cnt);
    'Increment our counter
    cnt += 1
Next

'Print out string on saved location
Locate Hiword(myInt), Loword(myInt)
Print "We stored the screen location in a single uinteger!"

Sleep
End