Solved

Send Keystrokes to vb.net windows app

Posted on 2004-04-02
18
1,016 Views
Last Modified: 2012-06-27
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
Comment
Question by:scorpion53061
  • 9
  • 5
  • 3
  • +1
18 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 250 total points
ID: 10740332
System.Windows.Forms.SendKeys.Send("ABC")
0
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 250 total points
ID: 10740523
Are yyou dealing with AS400? Is this the reason you using EBCIDIC
0
 

Author Comment

by:scorpion53061
ID: 10740822
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
 
LVL 12

Expert Comment

by:farsight
ID: 10741069
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 10741412
I don't know what you are doing, but try not to use sendkeys. Not a good idea. Come up with alternative
0
 
LVL 12

Expert Comment

by:farsight
ID: 10743853
I agree.  SendKeys is a last resort.
0
 

Author Comment

by:scorpion53061
ID: 10744567
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
 
LVL 28

Expert Comment

by:iboutchkine
ID: 10744614
What telnet is doing with these chars? Where does it send it to?
0
 
LVL 12

Expert Comment

by:farsight
ID: 10746777
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:scorpion53061
ID: 10749537
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
 
LVL 12

Expert Comment

by:farsight
ID: 10750596
> 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
 

Author Comment

by:scorpion53061
ID: 10750785
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
 
LVL 12

Expert Comment

by:farsight
ID: 10751138
> 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
 
LVL 12

Expert Comment

by:farsight
ID: 10751237
[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
 
LVL 12

Expert Comment

by:farsight
ID: 10751247
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
 
LVL 12

Expert Comment

by:farsight
ID: 10751334
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
 
LVL 12

Expert Comment

by:farsight
ID: 10751350
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
 

Author Comment

by:scorpion53061
ID: 10808471
There does not appear to be an answer but this question needed to be closed. Very disappointing.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now