Solved

Running Two Executables (one after another)

Posted on 2002-05-02
10
142 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

822 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