Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Send Keystrokes to vb.net windows app

Posted on 2004-04-02
18
Medium Priority
?
1,054 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 1000 total points
ID: 10740332
System.Windows.Forms.SendKeys.Send("ABC")
0
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 1000 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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
 

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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

972 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