Click here to Skip to main content
15,885,914 members

VB.Net - Convert KeyCode

bEGI23 asked:

Open original thread
Hi people im trying to create an UI Application on which is shown what the User actually types and which will be shown on the Window of the Application, to say like a Bar on the top of the Desktop, on which the typed Keystrokes are presented and which will continuosly move from right to the left side, like in a Exchange you see.

My problem is i use the GetAsyncKeyState() API Function and this only represents the Ascci Keycodes and not the same as when you type in Textbox like "Here".
What i want to say is that it doesnt really recognize what the Keyboard commands(Shift & a, which returns 'a' but not 'A') and also it doesnt represent the Keyboard Languages like Arabic and Cyrillic or Chinese.

Is it even possible to automate an App to do this which less code?

My Example;


VB
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vkey As Integer) As Integer

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim Result as integer
For i = 1 to 255                                  
       Result = GetAsyncKeyState(i)
       If Result = -32767 then               
             textbox1.text = Cstr(chr(i))
       End If
Next
End Sub


Can you give me a tip where to search for the solution or is it something easy which i didnt yet realise?
Tags: Visual Basic, Convert

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900