Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1067
  • Last Modified:

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?
0
scorpion53061
Asked:
scorpion53061
  • 9
  • 5
  • 3
  • +1
2 Solutions
 
Mikal613Commented:
System.Windows.Forms.SendKeys.Send("ABC")
0
 
iboutchkineCommented:
Are yyou dealing with AS400? Is this the reason you using EBCIDIC
0
 
scorpion53061Author Commented:
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.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
farsightCommented:
0
 
iboutchkineCommented:
I don't know what you are doing, but try not to use sendkeys. Not a good idea. Come up with alternative
0
 
farsightCommented:
I agree.  SendKeys is a last resort.
0
 
scorpion53061Author Commented:
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
.
0
 
iboutchkineCommented:
What telnet is doing with these chars? Where does it send it to?
0
 
farsightCommented:
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 http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20934876.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?
0
 
scorpion53061Author Commented:
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.

0
 
farsightCommented:
> 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!
0
 
scorpion53061Author Commented:
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
0
 
farsightCommented:
> 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?
0
 
farsightCommented:
[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.
0
 
farsightCommented:
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
0
 
farsightCommented:
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)
0
 
farsightCommented:
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__.
0
 
scorpion53061Author Commented:
There does not appear to be an answer but this question needed to be closed. Very disappointing.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 9
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now