Solved

Virtual Keyboard

Posted on 1998-07-30
13
1,936 Views
Last Modified: 2013-12-04
I need to find out how I can implement a virtual keyboard that returns standard keyboard events whenever a key is pressed. This means that I can use the virtual keyboard to type any documents in Winword or Excel, thereby acting just like a physical keyboard. It would be even better if there is such a product in the market which I can buy off the shelf.
0
Comment
Question by:wmlim060298
  • 6
  • 5
  • 2
13 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1411498
If you vant to progrem it, you should use the keybd_event() function.
Can't tell you about off-the-shelf availablity though.
0
 
LVL 6

Accepted Solution

by:
snoegler earned 50 total points
ID: 1411499
My company wanted me recently to write a tool which redirects rs232 serial input to the
standard keyboard input, i.e. every character received by the rs232 will be converted to a
keypress which all standard win95 applications accept.
If you are interested in this you can download it either on the companys homepage (http://www.dietrich-pos.com) - which is in german - or at my own homepage at
http://absd.hypermart.net (the page is right now under construction, but download things
work already).
0
 

Author Comment

by:wmlim060298
ID: 1411500
I forgot to mention that I need to implement this virtual keyboard in the Win NT 4.0 environment.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1411501
keybd_event() works fine under NT4
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1411502
If you like to download it directly: http://absd.hypermart.net/serialkb.exe (case sensitive)
It has been tested under NT and it should work.
( i am doing this with keybd_event , as alexo suggested)
0
 

Author Comment

by:wmlim060298
ID: 1411503
snoegler,
Thanks ! I have downloaded it. However, I do not know how to use it, do you have the readme file?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:snoegler
ID: 1411504
It has a context menu entry 'Configuration' where you can enter your serial communications port
and the transmission parameters.
'Autorun SerialKB Translator' will automatically load the program as a tray bar icon on each
startup. I hope that helps you, i am not sure if this is what you want???
0
 

Author Comment

by:wmlim060298
ID: 1411505
I actually have a touchcreen where I need to draw the keyboard onto the screen where when a user touches the "key A", then I should be able to send a keyboard event to inform the application for example Winword that I have typed "A", just like I typed "A" on the physical keyboard. Does the file which I downloaded "serialkb.exe" serve this purpose?
It will definitely make things easier if there is such a product readily available.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1411506
Sorry this is a big misunderstanding.
If you want to do what you mentioned, i would suggest you to
a) reject my answer
b) Browse www.shareware.com for a product which does what you want ( as far as i know
    there exist various, so it should not be hard to find)

If you really want to program a tool like the one you need the keybd_event() function, which alexo mentioned also is the way to go. Look in your online help for more information
0
 

Author Comment

by:wmlim060298
ID: 1411507
I actually have a touchcreen where I need to draw the keyboard onto the screen where when a user touches the "key A", then I should be able to send a keyboard event to inform the application for example Winword that I have typed "A", just like I typed "A" on the physical keyboard. Does the file which I downloaded "serialkb.exe" serve this purpose?
It will definitely make things easier if there is such a product readily available.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1411508
"serialkb" does only convert serial communications data into keystrokes, but that is definitely
not what you want - i misunderstood you.
I think you should consult altavista or shareware.com if you're searching a tool which does this
for you. I do not have enough time to do this - do it yourself :)
If you like to code it yourself, just use this keybd_event() function as alexo mentioned.
It is really simple: keybd_event( 'A', 0, 0, 0); will generate an 'A'.
( for some applications you need to specify the scan code - which is the second parameter
and would be '30' for the character 'A').
I hope this helps a bit
0
 

Author Comment

by:wmlim060298
ID: 1411509
snoegler,
Thanks! I have downloaded a shareware on virtual keyboard. However, I found that I had to specify which type of application I want the text to appear in and then nothing happens after I had selected it.

What is a scan code? When do I have to specify scan code since you mentioned that I only need to specify scan code for some applications. Does keybd_event('A',0,0,0) return an 'A' and any editor be it notepad, Winword, Wordpad, etc can understand it because it is a standard?
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1411510
I noticed errors when using keybd_event on DOS-Boxes. But you can easily find out the scan
code (i forgot to mention that) by using the function MapVirtualKey.
Just take a look into the Online help - but if you don't have an explanation there:

UINT MapVirtualKey(UINT uCode,UINT uMapType)

For your purpose, just pass the virtual key code( which is the same as the ASCII code for
standard characters like 0-9, A-Z and so on) as 'uCode' and set uMapType to zero.
The return value is the scan code.
I am not sure if this is important to windows, but if a key gets released its scan code
is 0x80(128) shifted. I.e. the scan code '30'(A) is the press code, '158' is the release code.

Now you can use the return value - which is the scan code - as the arg for keybd_event.
To send a complete keystroke ( for example an 'A'):

keybd_event('A',MapVirtualKey('A',0),0,0);
keybd_event('A',MapVirtualKey('A',0)+128,KEYEVENTF_KEYUP,0);
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now