Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Keypress Problem

$
0
0
Hey guys,

Dim x as String = "Space"
Dim y as String = "LControlKey"
If GetAsyncKeyState(x) = -32768 And GetAsyncKeyState(y) = -32768 Then
                AccessControl()
            End If


What I'm trying to do with this piece of code is, check if the button contained within the string x/y is being pressed. So, for example, if x = "H" and y = "LControlKey" I wanna check if "H" and the "LControlKey" are being pressed at the sametime. The problem I'm facing is that x/y are strings and I'm not sure how to convert them into keypresses so that I can use GetAsyncKeyState to check if they're pressed or not.

Sorry if it's a little confusing, but anyone know hwo to fix this?

Another example,
Lets say x = "Shift" and y = "Enter", then I wanna check if Shift and Enter are being pressed at the sametime. Thanks again.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>