Solved

Running Two Executables (one after another)

Posted on 2002-05-02
10
140 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
 

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

762 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

17 Experts available now in Live!

Get 1:1 Help Now