jrspano
asked on
send command to dos window
I need to send a txt string to a dos window telnet session
if you use activateapp and then send keys the telnet sessing pops up in front of everthing I don't want this
i need some api like
SendMessage HWNDOFtelnet, WM_SETTEXT, 1, "Some message"
etc.
if you use activateapp and then send keys the telnet sessing pops up in front of everthing I don't want this
i need some api like
SendMessage HWNDOFtelnet, WM_SETTEXT, 1, "Some message"
etc.
listening...(might jump in later if I find the link I had.)
Try this answer that worked when I asked a similar question:
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20094939
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20094939
ASKER
I havent tried it yet but looking at the link rspahitz you still have to have the dos window in focus to use it. I want the telnet window to get the keystroke without getting focus.
There's probably a way, but since DOS has a life of its own, it may be easier to use a Windows-based tool for the job. Unfortunately, even the Win2000 version of FTP uses a DOS-style Window.
Have you tried getting the handle of the Window and using a SendMessage string? (Personally, I've never tried it so I probably can't help much with its usage, but I'll bet Paul could!)
Have you tried getting the handle of the Window and using a SendMessage string? (Personally, I've never tried it so I probably can't help much with its usage, but I'll bet Paul could!)
ASKER
I have tried getting the return from shell and passing that to sendmessages. it didn't work. do you think the handle of the window would be better? or is there something that can send messages to a process id?
Have you tried using SendKeys?
Use the Api FindWindow to get the handle of the Dos window.Then send the text to dos window using
SendMessage hDosWnd, WM_CHAR, Asc(Char),byval 1
For executing any command use,
SendMessage hDosWnd, WM_KeyDown, Virtual Key Code..,byval 1
SendMessage hDosWnd, WM_KeyUp, virtual...,byval 1
hope this solves ur problem
SendMessage hDosWnd, WM_CHAR, Asc(Char),byval 1
For executing any command use,
SendMessage hDosWnd, WM_KeyDown, Virtual Key Code..,byval 1
SendMessage hDosWnd, WM_KeyUp, virtual...,byval 1
hope this solves ur problem
ASKER
andrew yep tried that it works great except that the dos window gets the focus ever time. I want to avoid this
devendra i'll try your idea in a little while
thanks
devendra i'll try your idea in a little while
thanks
ASKER
devendra: what would the classname of the window be for the findwindow api??
ASKER
i'm going to bump up the points and make the question larger.
when sending the keys to the telnet window i send a command followed by enter this does something in the telnet and gets a response back from the server. is there any way to see what the returned string is in the vb app?
when sending the keys to the telnet window i send a command followed by enter this does something in the telnet and gets a response back from the server. is there any way to see what the returned string is in the vb app?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yep i think you are right. i cant get anything but send keys to work. thanks for the links. i think we are going to make the server piece over again using vc++. Do you know of any working apps that run 24/7 that listen to a telnet port and validate data that work for long periods of time??? any one using something like this?