02-02-2026, 01:43 AM
Code: (Select All)
' Declare the Windows API function
DECLARE LIBRARY
FUNCTION GetAsyncKeyState% (BYVAL vKey AS INTEGER)
END DECLARE
' Windows Virtual-Key Constants
CONST VK_CONTROL = &H11
CONST VK_OEM_PLUS = &HBB ' The + / = key
CONST VK_OEM_MINUS = &HBD ' The - / _ key
CONST VK_ESCAPE = &H1B
DIM counter AS INTEGER: counter = 0
DIM plusPressed AS INTEGER: plusPressed = 0
DIM minusPressed AS INTEGER: minusPressed = 0
PRINT "Counter: 0"
PRINT "Use Ctrl + [+] to increase and Ctrl + [-] to decrease."
DO
' Check if Ctrl is held down
IF GetAsyncKeyState%(VK_CONTROL) AND &H8000 THEN
' Handle Plus (+) Key with debouncing (only trigger once per press)
IF GetAsyncKeyState%(VK_OEM_PLUS) AND &H8000 THEN
IF plusPressed = 0 THEN
counter = counter + 1
GOSUB RefreshDisplay
plusPressed = 1
END IF
ELSE
plusPressed = 0
END IF
' Handle Minus (-) Key with debouncing
IF GetAsyncKeyState%(VK_OEM_MINUS) AND &H8000 THEN
IF minusPressed = 0 THEN
counter = counter - 1
GOSUB RefreshDisplay
minusPressed = 1
END IF
ELSE
minusPressed = 0
END IF
END IF
' Exit if ESC is pressed
IF GetAsyncKeyState%(VK_ESCAPE) AND &H8000 THEN EXIT DO
_LIMIT 60
LOOP
END
RefreshDisplay:
CLS
PRINT "Current Counter:"; counter
PRINT "Use Ctrl + [+] to increase and Ctrl + [-] to decrease."
RETURN
Should work under wine on linux...hope it helps
Me

