Welcome Guest.   Make a donation to an author on the site April 23, 2014, 01:25:29 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2013! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Waiting for program completion in Visual Basic 2008  (Read 3086 times)
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: February 11, 2008, 12:20:02 AM »

I am trying to run multiple (anywhere from 2 to 6) programs after the user clicks a button. I can do that just fine, with the exception of them all starting at once. I have tried using the Shell command and using that to Wait, however VB9 doesn't allow that to do anything, so I am stuck with Process.Start("myprocess.exe").

I need to know how to wait for the first program to complete its work and close before executing the next (I don't want to get into loops or anything timer based, if that is possible). I don't want it to time out and run the next program- it has to wait for the program to close to work properly.

Anyone?

-Brandon
Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
mwb1100
Supporting Member
**
Posts: 1,228


View Profile Give some DonationCredits to this forum member
« Reply #1 on: February 11, 2008, 01:15:57 AM »

If I understand your question right, then all you have to do is call the WaitForExit() method on the Process object returned by Process.Start( "myprocess.exe").  Something like:

Formatted for vb.net with the GeSHI Syntax Highlighter [copy or print]
  1. Dim proc as Process
  2.  
  3. proc = Process.Start( "myprocess.exe")
  4. proc.WaitForExit()
  5.  
  6. proc = Process.Start( "myprocess2.exe")
  7. proc.WaitForExit()
  8.  
  9. ' and so on...

« Last Edit: February 11, 2008, 01:57:15 AM by mwb1100 » Logged
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: February 11, 2008, 04:52:14 PM »

Yes, exactly what I was looking for! Thanks!!! smiley
Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
Renegade
Charter Member
***
Posts: 10,364



Tell me something you don't know...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: February 20, 2008, 03:21:23 PM »

Just a note, but I think that you should make sure that you spin that code off into another thread and poll it for completion.

Otherwise you may end up with some nastiness.
Logged

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker
mahesh2k
Supporting Member
**
Posts: 1,406



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: February 21, 2008, 07:24:17 AM »

 Grin
i accidently thought it means logic completion that could ruin alll human programmers and will start the AI rage like this one.
http://www.swatkats.us/unlikely_alloys

smiley
Logged
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: February 21, 2008, 09:23:39 AM »

Just a note, but I think that you should make sure that you spin that code off into another thread and poll it for completion.

Otherwise you may end up with some nastiness.
DON'T POLL!

If he's doing a GUI and doesn't want to lock that up, sure, put program launch in a work thread. But don't frigging poll, have the worker-thread post a "I'm done" message to the GUI thread. Polling is evil and lame, except for a very small set of problems.

Logged

- carpe noctem
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.042s | Server load: 0.2 ]