Solved

Running Two Executables (one after another)

Posted on 2002-05-02
10
145 Views
Last Modified: 2010-05-02
I have two Executables (VB 6.0). First i want to start the application with one Exe. And based on the variable value i am collecting from the first EXE i want to end the first one and start the second EXEecutable or i may not start the second one at all. This should be seemless to the user. I do not know which is the best way to do.
0
Comment
Question by:svenkatapuram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 3

Expert Comment

by:nzjonboy
ID: 6987204
you could write the value to an ini file and then call the next executable, the next executable could then read the value and could also get the handle of the first and close it or the first could close itself. another way would be to parse the value in the command line for the second executable and read it from there.

nzjonboy
0
 

Author Comment

by:svenkatapuram
ID: 6987244
I do not want to do the first way. Can you be more specific about the second method. (Reading from the command line)
0
 
LVL 4

Expert Comment

by:Glowman
ID: 6987296
Sven,
You can pass a command line variable to the second exe by shelling the second exe with a command line parameter.  (syn: Shell(App.Path & "\My2ndExe.exe /Option1",vbNormal))
then in your Second app look for the command line parameter and code according to the result.  (syn : Dim MyValue as String

MyValue = Ucase(Command)
)
This will the allow you to write a select case based on the different options that are able to be passed.  Hope this helps
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Expert Comment

by:HobbitHouse
ID: 6987395
possbily I misunderstand your question but here's what I think you're asking:

How do I have one application decide whether or not to kick off a second application (and I don't have to pass any information from one to the other).

If that's what you're trying to do, then just

if decision = YES then

end if
0
 

Expert Comment

by:HobbitHouse
ID: 6987396
possbily I misunderstand your question but here's what I think you're asking:

How do I have one application decide whether or not to kick off a second application (and I don't have to pass any information from one to the other).

If that's what you're trying to do, then just

if decision = YES then

end if
0
 

Expert Comment

by:HobbitHouse
ID: 6987400
sorry, I hit the wrong key.

I mean:

if decision = YES then
shell "<second app path & name>"
end if
0
 
LVL 3

Accepted Solution

by:
n_narayanan earned 50 total points
ID: 6987796
1st EXE

Lets say you wanted to take a decision

If pwd = "something" then
  dim strexe as string
  strexe = "2nd.EXE" & " " & " ABC"
  Shell(App.Path & "\2ndExe.exe ",vbNormal)
  end
else
  end
end if

===========
In 2nd EXE
Form_Load Event,

dim passedvalue as string
passedvalue = command

If Len(Trim((Command$))) = 0 Then
   'Not a valid arguement
   'Hence it is called by user not by the 1st exe
   end
end if

if Command$ <> "ABC" then
   'Arguement is wrong.
   end
end if
   
This way you can authendicate the 2nd exe from 1st exe.

Cheers

Narayanan




0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6987798
Sorry, please read shell(app.path,"\2ndexe.exe", vbnormal) in the above comment as

Call Shell(App.Path & "\2ndExe.exe ", vbNormal)

Narayanan
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6987803
Ohhh, again made a mistake

it should be

Call Shell(strexe, vbNormal)
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6994016
Any specific reason for grade "B"?

Narayanan
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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