coderJeff wrote: ↑Nov 05, 2023 15:58
Newer versions of windows should limit function of GetAsyncKeyState() to the currently focused window.
This isn't true. GetAsyncKeyState is 'get the current state of the key from the keyboard'. Which app asked for it and which app is currently being interacted don't factor into it. GetKeyState is the one that's tied to apps, but it's unreliable in console apps since they don't have a message loop.
I'm not sure what the issues are this change was fixing, but with this, Multikey will respond positively to input typed anywhere (and maybe that's ok, idk). For instance, run this (with the changed code), minimize the console, click whatever app you like and press A. You get the "A pressed" message without any inkey.
Code: Select all
dim inkeystr as string
dim wholestr as string
wholestr = ""
If MultiKey(FB.SC_A) Then
inkeystr = Inkey
wholestr += inkeystr
Loop Until inkeystr = ""
Print "A pressed, inkey is " & wholestr
Loop Until InKey = "q"
You can still get something similar with the old MultiKey code if you run the above simultaneously in two Windows Terminal tabs. Activate either tab and press A, the message will appear in both.
Also, the changelog comment says Win 10, the version check in the code is Windows 7 (<= Vista).