Sending Keystrokes

A

Arthur Dent

Hello all...

I am trying to send keystrokes to an application. The application is
irrelevant. My software resides on a Symbol unit with a mag-stripe reader.
What we want is for the user to be able to configure a prefix and suffix, so
that when they swipe a card, it will read the card, prepend/append the
prefix and suffix and then just forward on all that string data to the
currently active window. The BIGGEST point of this, is control characters,
so that the user can set a suffix of TAB + ENTER, such that when a card is
swiped, it will put the read data into a text field, then automatically tab
to the next control (a button) and press enter, thereby submitting a form.
(this other application is some 3rd party 'ware we have no access to
change).

Everything works fine, except for the control characters. They work kind of,
but not the way we need... if i have open a wordpad or notepad type app, it
will insert the TAB and CR into the document as you would expect. But in a
form, the tab character doesn't advance controls (it just beeps) and the
enter key the same, it doesnt actually press a button (even if i put the
focus on the button first), again, it just beeps.

I am using the SendKeys code from OpenNETCF.org, I have tried sending the
keys using the escape words as in the code ("{TAB}" and "{ENTER}") and i've
tried actually just embedding Chr(9) and Chr(13) in the text string being
processed. But neither works.

Please help, i Have to be able to send control keystrokes to the focused
form.

Thanks in advance,
Arthur Dent.
 
A

Arthur Dent

Okay --- never mind, i fixed it.

I just found the implementation in the OpenNETCF.Windows.Forms namespace, so
i switched from using my compiled copy of the samples to the one from the
framework. Now it works... i obviously didnt have something right in my
code.

CheerZ all!
 
P

Paul G. Tobey [eMVP]

Control keys are problematic with PostKeybdMessage. keybd_event works much
better for that sort of key.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top