Solved

write string to running program

Posted on 2000-02-26
6
141 Views
Last Modified: 2010-05-02
Hello Experts!!

I have a simple question;

I make use of a Windows-DOS program, and needs to send a string to that program, like "add user brian". How can I do that? I work in VB5_pro.

I expect that I have to make use of SENDKEYS, but how do I call the right program. Not shell - since I do not want to execute the program, it is already running.

Can some one help with this question?

Thank you!

/Jens*

0
Comment
Question by:Jens979
6 Comments
 

Expert Comment

by:jhedlund
ID: 2561419
Do you have access to the code of the program you wish to receive the message (the Windows/DOS one)?  If so, you could have it constantly reading a file that another one writes commands to.  Or look into DCOM.

If you do not have access to the code, you may not be able to send a message to the other program.  How does the other program work?  Command line arguments?  Can't you stop that program and reload it?
0
 
LVL 5

Accepted Solution

by:
KDivad earned 75 total points
ID: 2561460
SendKeys can't send text to a DOS window, but there is a work-around that usually works just fine.
(Note: DOS app may need to be running in a window instead of full-screen for this to work)

Try:

Appactivate Caption_Of_Window_To_Activate, True
ClipBoard.SetText Text_To_Send, vbCFText
SendKeys "% ", True
SendKeys "ep", True

Hope this helps!
0
 
LVL 1

Expert Comment

by:Maquiavelo
ID: 2561570
 Very clever KDivad!!!
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 3

Expert Comment

by:fibdev
ID: 2561684
kudos kDivad
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2562285
Thanks! Let's see if Jens agrees...
0
 

Author Comment

by:Jens979
ID: 2567619
Well I could not get it working, tried a little, but then found out another way. Seems there is a commandline thing included with my server that this was for ~:\

Anyway I grade KDivad. But thanks to you all experts!

/Jens*
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

813 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

18 Experts available now in Live!

Get 1:1 Help Now