473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Waiting for a process to halt before continuing

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
5 3194
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

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
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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hi all Just a quick question more about the flow of an asp page. IF I have code as below: - MyDBConnection.Execute "Insert Record Into A Table" MyRecordset.Open "Retreive the same record from...
2
by: Bob | last post by:
Does anybody know what might cause the following message to show up in the SQL Server Error Log?: Time out occurred while waiting for buffer latch type 2, bp 0x12260f80, page (5:77914), stat...
77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
22
by: nd02tsk | last post by:
Hello! I have a couple of final ( I hope, for your sake ) questions regarding PostgreSQL. I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: ...
4
by: Chip | last post by:
Can somebody explain to me why my process continues to run after I halt execution? This plays havoc with debugging. I expect to be starting a new instance at the beginning of a loop and the first...
2
by: Bob | last post by:
I launch Word from within my application (Vs2005, VB) and I would like to make it necessary for the just opened Word to be closed before the rest of my code in the calling sub can execute. How can...
1
by: Sladan | last post by:
Hi! I'm currently writing a poker program i .net compact framework. In one method I have a while-loop that goes through every player until everyone is finished betting. What I need is some way to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.