Link to home
Start Free TrialLog in
Avatar of scorpion53061
scorpion53061

asked on

Send Keystrokes to vb.net windows app

I need to send this keystroke to a vb.net application. This came from ethereal. Here is its value in "Hex Dump"

00000000  1b 65 0d                                         .e.


Here is its value in ASCII

e

Here is its value in EBCDIC

.

Here is its value in "C Arrays". I am not exactly sure what they mean here.

char peer0_0[] = {
0x1b, 0x65, 0x0d };


Does anyone know how I might utilize this to send what I need to in my vb.net windows app?
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scorpion53061
scorpion53061

ASKER

No I am giving possibilities.

Ethereal gave me 3 ways to look at the data and I was hoping someone would have some insight with the methods I was showing.

What is happening here is that on my system (RISC6000 running AIX 5.1) it is using a ibm3151 emulation. I have been able to map all of the other function keys in my vt100 emulator that I built with vb.net but the F5 key - which is the representation I showed with the 3 examples above- is causing me problems.

I am using Ethereal to watch what was being sent by the 3151 emulator so I could attempt to mimic it in my vb.net application.
I don't know what you are doing, but try not to use sendkeys. Not a good idea. Come up with alternative
I agree.  SendKeys is a last resort.
I am not doing "SendKeys"

 If (Control.ModifierKeys And Keys.Shift) = Keys.Shift Then
                        'MsgBox("Shift F5 captured!")
                       'Telnet1.Send((Chr(27) & Chr(101) & Chr(13)))
End If

Telnet1 is a custom control
.
What telnet is doing with these chars? Where does it send it to?
The confusion is:
(a) Do you want to send the keys to a window?
> "Send Keystrokes to vb.net windows app"
> "I need to send this keystroke to a vb.net application."

or

(b) Do you want to send the characters over the wire via Telnet?
> "'Telnet1.Send((Chr(27) & Chr(101) & Chr(13)))"
> "Telnet1 is a custom control"

I think I clearly answered (b) in https://www.experts-exchange.com/questions/20934876/ASCII-Conversions-I-think.html#10740012
If not, go there and clarify your question.  Also, clearly delineate what is input keystrokes and what is to be sent over the wire.  (Though you haven't explicitly stated it, I get the idea that you're writing something that detects keystrokes, and then forwards then over the wire, something involving some translation.)

It's seems like you might be asking the same question here even less clearly.
What exactly is still unknown?
The answer is b.

What is unknown is why in my application I am building are the results different.

I know now I am sending this every time I hit F5 :

 1B 65 0D                                          .e.

but some one else suggested something to me. They said maybe the result

Telnet1.Send((Chr(27) & Chr(101) & Chr(13) & Chr(14))

is not sending it at exactly the same time as the statement it is converting. Do you think this is possible and how might I address that?

By the way farsight if and when a solution to this problem gets acquired you will get the points on the other question.

I am running out of time and I need to get more input from others.

> What is unknown is why in my application I am building are the results different.
Are you intentionally trying to keep us in the dark?  This statement applies to about 99% of questions asked here.

Please, give us some detail.  What application?  What results? What's different?
What devices are you working with?  Is hardware even an issue in this problem?
What are the inputs?  What are the outputs?
We cannot help if you don't tell us what the whole situation is.  You are our eyes and ears!

I've noticed you have a lot of deleted/refunded questions -- and I know it's not because we're not trying to answer.
I think you should put a bit more effort into clearly specifying what your problems are.
It would be less frustrating for us and you!
Thank you for your comments farsight. I will attempt to explain this from the beginning.

I am building a vb.net windows application that allows users to telnet into my RISC6000 AIX 5.1 system using a vb.net windows application as the front end. It uses a protocol called ibm3151.

The control that makes this possible in the windows environemnt uses vt220_7 emulation. Normally function keys F5-F12 do not exist. Workarounds must be obtained because ibm3151 emulation uses F5-12.

I did find workarounds for F1-F4, and F6-F12.

For F5 if I were using a ibm3151 emulator it sent the following information when F5 was hit:

 1B 65 0D                                          .e.

It was necessary in my vt220_7 vb.net control to make a similar event happen.

I came up with

Telnet1.Send(Chr(0) & Chr(27) & Chr(1) & Chr(5) & Chr(10))

and

Telnet1.Send(Chr(27) & Chr(101) & Chr(13))

Unfortuantely though the expected result within my system when F5 was hit did not occur. I did run across an instance though where

Telnet1.Send(Chr(0) & Chr(27) & Chr(1) & Chr(5) & Chr(10))

did work. But in other places it does not work.

This is my predicament. Am I interpreting something wrong in your opinion?

IN respect to deleted and refunded questions:

As I grew in vb.net programming, my questions became harder. OFten no answer was forthcoming or I woudl find the solution myself eventually.

I have never been critical of anyone on this board. And again I apologize if I frustrated you.

When I send the following statement with my vt220_7 control to my ibm3151 system
> For F5 if I were using a ibm3151 emulator it sent the following information when F5 was hit:
> 1B 65 0D                                          .e.
Do you mean: when you use and IBM3151 emulator it does send this, and it works correctly with the application you're driving on the RISC6000 AIX 5.1 system?

If so, then that is exactly the sequence your VB.NET program needs to send.

Try to determine if the Telnet1 control is modifying what you send.  What happens when you run ethereal, and have it track what the VB.NET program sends with Telnet1.Send(Chr(27) & Chr(101) & Chr(13))?  Does it send exactly the same thing as the IBM3151 emulator?
[OffTopic:  About better questions]
That last problem description was much better.  Thanks.

>  OFten no answer was forthcoming
What I wonder is: Was that because the question was hard (I don't think so), or because the question was hard to understand?  (I suspect so).

I'm not trying to be critical, I just wanted to give you the feedback that:
  Better questions will result in better answers.

What's a better question?  In three words:  Clear, Concise, Complete.  (I actually have this posted on my wall.  ;-)    )
  Clear: Unambiguous.  Correct.  Make distinctions between the various parts and pieces.  Delineate what IS happening, what IS DESIRED to be happening.
  Concise: Says a lot without using a lot of words.  Omit any irrelevant information.
  Complete: Include ALL the relevant information.  What are all the parts involved?  What are the important attributes or traits of the parts?  How are the parts related?  What possible solutions have already been tried (and why), and have failed (and why)?

As an example:  This question is titled:  "Send Keystrokes to vb.net windows app"
If I understand correctly now, (a) It's not about sending keystrokes, it's about sending characters over the wire via a Telnet control.  (b) What we're sending is not going to a VB.NET application.  It's coming from a VB.NET application, and being sent via a Telnet control emulating a VT220_7, to some unspecified IBM-3151 compatible application running on a RISC6000 AIX 5.1 system.  (c) It's not really about sending at all.  It's about knowing what characters to send that represent F5 on the IBM-3151.

  Better questions will result in better answers.
If all else fails, perhaps you need an emulator like this one:
Glink       http://www.gar.info/glink/glink9.htm

It support the IBM3151 emulation directly, and it has a API, so you should be able to make you VB.NET program interact with it OK.

Manual:  http://www.gar.info/glink/pdf/r72/index.pdf
http://www.fifi.org/doc/emacs21/etc/termcap.src
Here's a termcap file that lists the ibm3151.  The definition of ibm3151 shows :tc=ibm3163:, which means read the rest of the keys come from the ibm3163 definition (which is identical to the ibm3161 definition).  The ibm3163 definition shows :F5=\E\041c\r:  which I take to mean ESCAPE + "!c" + CARRIAGERETURN.  All the other F-keys are shown there, too.

Reference on termcap/terminfo:  http://www.cs.utah.edu/dept/old/texinfo/termcap/termcap.html#SEC17
Reference, ASCII table: http://www.cs.mun.ca/~michael/c/ascii-table.html

On the other hand, I went to this link http://www.catb.org/terminfo/ which states "I maintain the master database of terminal descriptions ...".  I went to the master file  http://www.catb.org/terminfo/termtypes.master.gz , and it says:
    kf5=\Ee\r      and     kf15=\E!c\r
along with all the other key definitions.  The terminfo entry indicates the same thing.  The termcaps entry is like the other termpcaps file I used at the beginning of this message.

This tells me that the RISC6000 AIX 5.1 system (if it is truly expecting ibm3151 terminals), should accept one of two the sequences  \Ee\r  or  \E!c\r  to indicate the F5 key.  I don't know which one.  You already know how to use chr() and Telnet1.Send() for them.

If those don't work when sent, there are several issues I can think of that may be causing the problem.
(1) The RISC6000 AIX 5.1 system is set up to interpret something else as F5.
(2) The Telnet1 control is modifying the sequence of characters you send (for some unknown reason)!
(3) There are transmission problems in the wire -- bad cable, loose connection, interference, etc.
(4) Timing issues (as you asked earlier)
P.S. The points for THIS question should go to Mikal613, who first answered your question:
  Comment from Mikal613
  Date: 04/02/2004 06:20AM MST
  System.Windows.Forms.SendKeys.Send("ABC")

That is indeed the correct and quick answer to the __question that you asked__.
There does not appear to be an answer but this question needed to be closed. Very disappointing.