×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SendKeys <Esc> & <F1> not working VB6

SendKeys <Esc> & <F1> not working VB6

SendKeys <Esc> & <F1> not working VB6

(OP)
Hi

I am writing some code that will automate a process used alot at my place of work, i dont want to get to much into the exact nature of it just in case but it basically gathers the required information into the VB program and then inserts it into a KEA 340 terminal.

I have most of the code running fine but at certain points I need to mimic the keyboard pressing the escape key or the F1 key.

According to the help files xxx.SendKeys "<Esc>" should work (or "<F1>" for the F1 key) but it doesnt.

I have used the <return> command with no problems at all but unfortunatley I cannot progress with out the Escape or F1 keys.

A sample of the code..

xxx.WaitForCursor 22, 29, 1
xxx.SendKeys Trim$(txtxxx.Text) & "<return>"
xxx.WaitForCursor 22, 37, 1
xxx.SendKeys Trim$(txtxxx.Text) & "<return>"
xxx.WaitForCursor 22, 19, 1
xxx.SendKeys Trim$(txtxxx.Text) & "<return>"
xxx.WaitForCursor 17, 20, 1
xxx.SendInput "<F1>" ' nothing happens, no errors but no progression

xxx is hiding any names that could give away the nature of program, im sure none of you care but I wouldnt want to get in trouble lol

I have tried many different variations including using the SendInput command but nothing has worked.

Any help much appretiated

Thanks

RE: SendKeys <Esc> & <F1> not working VB6

(OP)
sorry to post again but I have just opened the on screen keyboard and pressed F1 and what should happen doesnt, it just displays "[11~" on the screen.

None of the F buttons on the on screen keyboard work the way they do on the physical keyboard

This may be a clue

RE: SendKeys <Esc> & <F1> not working VB6

You should open up the keyboard map and run the sendkeys in it rather than the key presses.

RE: SendKeys <Esc> & <F1> not working VB6

This might not be 100% clear. What I mean is use the keyboard map to determine the sendkeys. (e.g.; F1 = [11~, so set your code to write [11~ rather than use F1.)

RE: SendKeys <Esc> & <F1> not working VB6

Did you try recording a macro of key presses to find the key codes?

Also, don't know about KEA but on my system the "F" keys are prefixed with a "P"

SendKeys ("<PF8>")

and "Return" is

SendKeys ("<Enter>")

RE: SendKeys <Esc> & <F1> not working VB6

check your keyboard maps set up to ensure there
is a function for <F1> and if there isn't you
Can assign one.

Sess0.Screen.Sendkeys("<Ctrl+M>")
Which is an equivalent to <return>

RE: SendKeys <Esc> & <F1> not working VB6

(OP)
Thanks for your replies.

The keyboard mapping just wouldn't work no matter what I did.

I solved this problem by creating a smart pad for escape and another for and then invoked then when needed  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close