Dim As Long iPosCursor = Csrlin
Dim As String key
Do
Locate iPosCursor, 1, 0
key = Inkey()
? key
Select Case key
Case Chr(27), Chr(113) 'ESC or q to exit program
Exit Do
End Select
Sleep 50
Loop Until False
I got the repeat keys also.
win10
fb 1.07.2
64 bits
If you right click the console the clipboard gets pasted to it (as D.J.Peters says), on win 10 anyway.
If you do this just before the do loop, it should clear the clipboard
shell "cmd/c echo.|clip"
#Include "windows.bi"
Dim As DWORD cmode
Dim As HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE)
GetConsoleMode(hInput, @cmode)
SetConsoleMode(hInput, ENABLE_EXTENDED_FLAGS Or (cmode And Not ENABLE_QUICK_EDIT_MODE))
? "Press right mouse bottom"
Dim As Long iPosCursor = Csrlin
Dim As String key
Do
Locate iPosCursor, 1, 0
key = Inkey()
? key
Select Case key
Case Chr(27), Chr(113) 'ESC or q to exit program
Exit Do
End Select
Sleep 50
Loop Until False
SetConsoleMode(hInput, cmode)
#Include "windows.bi"
Sub SetConsoleSize(cols As Long, lines As Long)
Shell "MODE CON: COLS=" + Str(cols) + "LINES=" + Str(lines)
End Sub
Dim As DWORD cmode
Dim As HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE)
GetConsoleMode(hInput, @cmode)
SetConsoleMode(hInput, ENABLE_EXTENDED_FLAGS Or (cmode And Not ENABLE_QUICK_EDIT_MODE))
SetConsoleSize(90, 8)
? "Press right mouse bottom"
Dim As Long iPosCursor = Csrlin
Dim As String key
Do
Locate iPosCursor, 1, 0
key = Inkey()
? key
Select Case key
Case Chr(27), Chr(113) 'ESC or q to exit program
Exit Do
End Select
Sleep 50
Loop Until False
SetConsoleMode(hInput, cmode)
Sub SetConsoleSize(cols As Long, lines As Long)
Shell "MODE CON: COLS=" + Str(cols) + "LINES=" + Str(lines)
End Sub
SetConsoleSize(90, 8)
shell "cmd/c echo.|clip"
Dim As Long iPosCursor = Csrlin
Dim As String key
Do
Locate iPosCursor, 1, 0
key = Inkey()
? key
Select Case key
Case Chr(27), Chr(113) 'ESC or q to exit program
Exit Do
End Select
Sleep 50
Loop Until False
Thanks dodicat but it works a long as you don't have anything in the clipboard. After the code is started and you put something to the clipboard you can paste it again.
Further, I don't want to clear the clipboard because maybe the data is needed.
#include "windows.bi"
Sub SetConsoleSize(cols As Long, lines As Long)
Shell "MODE CON: COLS=" + Str(cols) + "LINES=" + Str(lines)
End Sub
SetConsoleSize(90, 8)
dim as any ptr h
dim as long DefaultMode
GetConsoleMode(h, @DefaultMode)
SetConsoleMode(h, DefaultMode and not ENABLE_QUICK_EDIT_MODE)
Dim As Long iPosCursor = Csrlin
Dim As String key
Do
Locate iPosCursor, 1, 0
key = Inkey()
? key
Select Case key
Case Chr(27), Chr(113) 'ESC or q to exit program
Exit Do
End Select
Sleep 50
Loop Until False
SetConsoleMode(h, DefaultMode)