Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Mon, 11 Aug 2008 09:05:34 -0700,    group: microsoft.public.win32.programmer.ui        back       


How to write a keyboard emulator?   
Thanks for the previous responses. I am reading your references. I just 
finsihed reading http://www.joelonsoftware.com/articles/Unicode.html for the 
first time and will probably have to read it again.

I need to write a keyboard emulator and my problem is that I don't 
understand exactly what  a keyboard does.
My keyboard emulator will display a keyboard on the monitor and use hit 
testing to detect which key the user has clicked on. Left mouse clicking on 
a key once will simulate depressing a key and left mouse clicking a second 
time will simulate releasing the key.
(1) Does that logic to combine the scan codes for modifier keys (like shift 
and ctrl) to produce a virtual keycode happen in the keyboard or the OS?
(2) In some forum somewhere someone enabled me to write a C# program which 
watches for a certain WM_* (I hope I can find the forum that explained this 
or the directory where I put that source code) so I detect when the user 
runs intl.cpl to change languages. When the user uses intl.cpl to change 
languages, does that change the behavior of the OS or the keyboard or both? 
What exactly does intl.cpl do? Does it change the code page for the current 
process?
(3) What is the function call to load a new (different) code page? Clearly 
MultiByteToWideChar and its cousin
WideCharToMultiByte accept a code page parameter, but that is just for 
converting between wide and narrow characters. (You would think the function 
I'm looking for would be in the same section in the documentation but I see 
no such function before or after 
http://msdn.microsoft.com/en-us/library/ms776413(VS.85).aspx -- perhaps 
there is no such function?). Do I need to set the code page for the current 
thread when implementing the logic that accepts multiple scan codes and 
produces a virtual key code? Incidently, is there an OS function that will 
do this for me? SetThreadPreferredUILanguages looks interesting, but looks 
like vista only. Is SetThreadUILanguage the function I want? Will this 
affect the logic that converts multiple scan codes to virtual key codes?
(4) What function do I call to capture keys like the windows flag key and 
ALT+TAB and ALT+SHIFT+TAB? Normally the OS will not pass these on to an 
application but I need to capture them and surpress their normal behavior.
(5) What is the logic for the windows flag key? Is it a modifier key? I 
think so: when you hit flag+r you get tje run dialog box. Does this mean 
there is a seperate virtual key code for flag+r? But when you hit just flag 
(unlike the other modifier keys) you get the start menu. Who decided when 
the flag key is a modifier key and when it is just a hot key? How does it 
decide?
(6) Where can I get the scan codes for the extra keys on a Korean or 
Japanese keyboard on each side of the space bar? Where can I get the scan 
codes for the Europeon ALTGR key?

Thanks so much!
Siegfried
date: Mon, 11 Aug 2008 09:05:34 -0700   author:   Siegfried Heintze

Re: How to write a keyboard emulator?   
On Mon, 11 Aug 2008 09:05:34 -0700, "Siegfried Heintze"
 wrote:

>Thanks for the previous responses. I am reading your references. I just 
>finsihed reading http://www.joelonsoftware.com/articles/Unicode.html for the 
>first time and will probably have to read it again.
>
>I need to write a keyboard emulator and my problem is that I don't 
>understand exactly what  a keyboard does.
>My keyboard emulator will display a keyboard on the monitor and use hit 
>testing to detect which key the user has clicked on. Left mouse clicking on 
>a key once will simulate depressing a key and left mouse clicking a second 
>time will simulate releasing the key.

So the user needs to press a key twice to send one character? I
wouldn't want to use such a keyboard.

>(1) Does that logic to combine the scan codes for modifier keys (like shift 
>and ctrl) to produce a virtual keycode happen in the keyboard or the OS?

I haven't tried to understand the details of your description, but it
seems way more complicated than necessary. Petzold and Yao present a
calculator emulator in their "Programming Windows 95" book. It
provides a pushbutton for each key, detects when each button is
pressed, and uses WM_CHAR to send the button's label.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
date: Mon, 11 Aug 2008 15:59:06 -0400   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us