By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

Waiting for a process to halt before continuing

P: n/a
What would be the simplest way to make an app wait for one process to
finish before starting the next process?

Example
///

FileCopy(strPath & "test.mdb", strPath & "live.mdb")
Wait(Until FileCopy is Done) <---------------That is what I'm
looking for
Shell(someapp.exe)

///
I want someapp.exe to start only after the file has been copied
completely, not run asynchronously. I've done some reading on
CreateProcess and WaitForSingleObject but they seem way more
complicated(lengthy) then what I need for this problem. In my little
program I'll need this command 60 - 80 times is why I'm looking for
brevity.

Thanks for any ideas.

Chris
Hello World - Check
First App - Working on it

Dec 28 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
As long as you don't do this multithreading there is no need to check if the
filecopy is done.

This is the standard approach in a serial program.

If you use instead of Shell, "process.start" than there is in that a method
to wait until that is done.

Cor
"Chris" <ch********@gmail.comschreef in bericht
news:11**********************@a3g2000cwd.googlegro ups.com...
What would be the simplest way to make an app wait for one process to
finish before starting the next process?

Example
///

FileCopy(strPath & "test.mdb", strPath & "live.mdb")
Wait(Until FileCopy is Done) <---------------That is what I'm
looking for
Shell(someapp.exe)

///
I want someapp.exe to start only after the file has been copied
completely, not run asynchronously. I've done some reading on
CreateProcess and WaitForSingleObject but they seem way more
complicated(lengthy) then what I need for this problem. In my little
program I'll need this command 60 - 80 times is why I'm looking for
brevity.

Thanks for any ideas.

Chris
Hello World - Check
First App - Working on it

Dec 28 '06 #2

P: n/a

Cor Ligthert [MVP] wrote:
As long as you don't do this multithreading there is no need to check if the
filecopy is done.

This is the standard approach in a serial program.

If you use instead of Shell, "process.start" than there is in that a method
to wait until that is done.

Cor
Thank you! I'm using it like this, and it seems to be working just
fine.

///
Dim myProcess As Process =
System.Diagnostics.Process.Start("c:\process1.exe" )
myProcess.WaitForExit()
myProcess = System.Diagnostics.Process.Start("c:\process2.exe" )
myProcess.WaitForExit()
myProcess = System.Diagnostics.Process.Start("c:\process3.exe" )
myProcess.WaitForExit()
///

Chris

Dec 28 '06 #3

P: n/a
I'm having a problem now. The path to my program is giving me a 'file
not found' error.

If I do this-
Shell("myapp.exe /dump " & strPath & "\db.mdb")
it works perfectly

If I do this-
myProcess = System.Diagnostics.Process.Start("myapp.exe /dump " &
strPath & "\db.mdb")
it says file not found.

All I did was replaced 'shell' with the process.start method.

I think it has something to do with the switch '/dump'

Any thoughts?

Chris

Dec 28 '06 #4

P: n/a
Chris,

Have a look at the differet samples we made.

http://www.vb-tips.com/dbpages.aspx?...a-14d6b93856e8

Be aware that the side is under construction at the moment.

Cor

"Chris" <ch********@gmail.comschreef in bericht
news:11*********************@42g2000cwt.googlegrou ps.com...
I'm having a problem now. The path to my program is giving me a 'file
not found' error.

If I do this-
Shell("myapp.exe /dump " & strPath & "\db.mdb")
it works perfectly

If I do this-
myProcess = System.Diagnostics.Process.Start("myapp.exe /dump " &
strPath & "\db.mdb")
it says file not found.

All I did was replaced 'shell' with the process.start method.

I think it has something to do with the switch '/dump'

Any thoughts?

Chris

Dec 29 '06 #5

P: n/a

Cor Ligthert [MVP] wrote:
Chris,

Have a look at the differet samples we made.

http://www.vb-tips.com/dbpages.aspx?...a-14d6b93856e8

Be aware that the side is under construction at the moment.

Cor
Thanks Cor!

I finally realized that I needed to seperate the program from the
arguments with commas. It's working well now.

Chris

Dec 29 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.