PDA

View Full Version : KeyBoard action problems



mitko
November 24th, 2002, 02:43 PM
Ron, I there is a problem with the Keyboard action.
I get different results when sending keys to the foreground application and to a given target.
If I target notepad for example and put "*" (asterisk) in the text I get it OK in notepad. But when I target it to the foreground application I get "8" (which is the same key). It's the same with other keys too: "(", ")", "*" and so on. I suppose you somehow get the scan code of a given character. I also have problems sending text that is not in the default ASCII interval. I'm talking about cyrilic characters which have ASCII codes greater than 127.

Do you have an idea how this can be fixed?
Can you also explain a little about the way you get a scan code or virtual key code of a given character? Is there such an API function? I'm asking this because I decided to use SendInput in my KeySelector plugin and have problems with getting the VK_.. of some characters

Ron
November 24th, 2002, 02:46 PM
If I have time left I'll look at the keyboard routines *again*. But I doubt I can fix them ( insert default key windows sending problem here ).

You need MapVirtualKey, look it up in the Win32 SDK.

mitko
November 24th, 2002, 04:17 PM
I've searched the MSDN, Delphi source and Google but couldn't find the values for:
KEYEVENTF_KEYUP,
KEYEVENTF_SCANCODE and
KEYEVENTF_UNICODE

Can someone help me? Ron? Mark?

mitko
November 27th, 2002, 10:03 AM
Ron, I didn't have time try MapVirtualKey but I think the problem with the keyboard actions when sending to the foreground application is connected with the shift states. Did you happen to forget tho check the shift states of the result of OemKeyScan or VkKeyScan or what ever you use to convert the character to a scancode or VirtualKey code?

And talking about converting character to a scancode or VirtualKey code.... I have huge problems with Cyrillic characters
:(
One thing is that the result of both
OemKeyScan and VkKeyScan (and VkKeyScanEx) depend on the active keyboard layout when the parameter is a Cyrillic character
:(
and the other thing is that OemKeyScan returns very strange values even with the correct keyboard layout
:(

Have you ever delved into this?

Ron
November 27th, 2002, 02:19 PM
No sorry, I didn't delve into this.

I have been thinking about working on the keyboard routines, but the prospect of that is not very appealing since it is such a undocumented area full of problems, also every application reacts differently to the keyboard routines.

Maybe a few people (including me) should team up and try to work this thing out, try to find the common denominator and the differences so we might get this to work *better*. Anyway I don't have enough time to keep working on Girder 4, and prepare for my graduation year and .. and .. and.. so I suggest putting this on hold until at least January. Unless you feel like working on it alone... I can give you access to some of the routines that Girder uses...

mitko
November 27th, 2002, 03:39 PM
I'm also pretty busy lately but in my spare time I'm trying to prepare my plugin and at the moment I'm up to the keyboard input simulation so I will try to find a good or at least a woring solution for this.

All ideas and help are welcome, so I'll appreciate it if you share some of your knowlage with me
:)