Execute an executable program.

H

Herfried K. Wagner [MVP]

Am 26.03.2010 10:21, schrieb Mr. X.:
How can I in code (VB.NET 2008) execute another executable program ?

'System.Diagnostics.Process.Start' or 'Shell' ;-).
 
H

Herfried K. Wagner [MVP]

Am 30.03.2010 09:45, schrieb Mr. X.:
What is the difference between process.start and shell?

'Shell' is VB's way, 'Process.Start' is the method in the .NET
Framework. There are some small differences, but in general
'Process.Start' is more powerful.
 
M

Mr. X.

One problem.
I did : process.start("myprog.exe")
but when returning the calling program, and trying do something I got the
message :
Unhandled exception has occurred in your application.
If you click Continue, the application will ignore this error and attempt to
continue ...

What should I do ?

Thanks :)
 
H

Herfried K. Wagner [MVP]

Am 30.03.2010 21:20, schrieb Mr. X.:
One problem.
I did : process.start("myprog.exe")
but when returning the calling program, and trying do something I got
the message :
Unhandled exception has occurred in your application.
If you click Continue, the application will ignore this error and
attempt to continue ...

Post the complete exception information (which exception, additional
exception message, etc.).
 
M

Mr. X.

OK, solved.

.... and about shell and process.start.
by command "shell" I can wait till I close the executable program (it may be
a modal dialog), and process.start doesn't have this option.
Besides, "shell" cannot send to the executable program arguments, and
process.start can.
I can use mutex & shell in order to send the executable program some
arguments.

Thanks :)
 
H

Herfried K. Wagner [MVP]

Am 30.03.2010 23:15, schrieb Mr. X.:
... and about shell and process.start.
by command "shell" I can wait till I close the executable program (it
may be a modal dialog), and process.start doesn't have this option.

\\\
Dim p As Process = Process.Start(...)
p.WaitForExit()
///
Besides, "shell" cannot send to the executable program arguments, and
process.start can.

I am pretty sure 'Shell' can actually do that. Did you try to include
the arguments in the path?
 
M

Mr. X.

It is true p.waitforExit() is waiting until I close the exe, which I have
called at the main program,
but if I click on the main program the button, which called the exe program,
several times,
computer "remembers" I have pressed the button, and hence when I close the
called exe program, the event occurs, and the exe is opened again.
same thing for shell : Shell("newApp.exe", AppWinStyle.NormalFocus, True)

If shell is the command line, then it's obvious that I can send parameters
within the command line.

Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top