473,396 Members | 1,734 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,396 software developers and data experts.

Waiting for another process?

I am writing a simple exe that will locate a company file for the user with
minimal input and open it in the appropriate application (Same as Explorer)
Problem is sometimes the user may want to open a few files. I was opening
them in a For....Next loop and it seems that if a file takes longer than a
few seconds to open it is dropping the other files. I presume that I need
to wait for the process that was sent to stop I think what I need to use is
Dim MyProcess as Process

Myprocess = Process.Start(psi)
Myprocess.WaitForInputIdle (INFINITE)

since the program will remain opened so the user can use the file as
desired. Would this be best practice or is there a better way to go about
it.
this.
TIA
Corey Scheich

Nov 21 '05 #1
8 1235
Corey,

Maybe is the best practise for this multithreading than the user can go on.

http://msdn.microsoft.com/library/de...isualBasic.asp

I hope this helps?

Cor
"Corey Scheich" <cE***************@garlockequiP.com>
I am writing a simple exe that will locate a company file for the user with minimal input and open it in the appropriate application (Same as Explorer) Problem is sometimes the user may want to open a few files. I was opening them in a For....Next loop and it seems that if a file takes longer than a
few seconds to open it is dropping the other files. I presume that I need
to wait for the process that was sent to stop I think what I need to use is

Dim MyProcess as Process

Myprocess = Process.Start(psi)
Myprocess.WaitForInputIdle (INFINITE)

since the program will remain opened so the user can use the file as
desired. Would this be best practice or is there a better way to go about
it.
this.
TIA
Corey Scheich

Nov 21 '05 #2
That will work quite well thank you for the direction

Corey

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ep*************@TK2MSFTNGP12.phx.gbl...
Corey,

Maybe is the best practise for this multithreading than the user can go on.
http://msdn.microsoft.com/library/de...isualBasic.asp
I hope this helps?

Cor
"Corey Scheich" <cE***************@garlockequiP.com>
I am writing a simple exe that will locate a company file for the user

with
minimal input and open it in the appropriate application (Same as

Explorer)
Problem is sometimes the user may want to open a few files. I was

opening
them in a For....Next loop and it seems that if a file takes longer than a few seconds to open it is dropping the other files. I presume that I need to wait for the process that was sent to stop I think what I need to use

is


Dim MyProcess as Process

Myprocess = Process.Start(psi)
Myprocess.WaitForInputIdle (INFINITE)

since the program will remain opened so the user can use the file as
desired. Would this be best practice or is there a better way to go about it.
this.
TIA
Corey Scheich


Nov 21 '05 #3
* "Corey Scheich" <cE***************@garlockequiP.com> scripsit:
That will work quite well thank you for the direction


Multithreading would be good in addition to your code, but it does in no
way replace your code (your code is OK).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
I was thinking of adding in in at the end of the sub that I was sending to
another thread and possibly triggering an event to check if everything was
OK. Thank you for the sound advice.

Corey

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
* "Corey Scheich" <cE***************@garlockequiP.com> scripsit:
That will work quite well thank you for the direction


Multithreading would be good in addition to your code, but it does in no
way replace your code (your code is OK).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
Herfried,
Multithreading would be good in addition to your code, but it does in no
way replace your code (your code is OK).


Why did you think that Corey or I (Cor) had another idea, I wrote that for
the solution as I thought it would be the best practise was probably
multithreading.

Cor

Nov 21 '05 #6
* "Cor Ligthert" <no**********@planet.nl> scripsit:
Multithreading would be good in addition to your code, but it does in no
way replace your code (your code is OK).


Why did you think that Corey or I (Cor) had another idea, I wrote that for
the solution as I thought it would be the best practise was probably
multithreading.


Well, I only wanted to make sure that the OP didn't understand your
suggestion as a replacement for the code he posted. The OP was asking
if there is any better way to do what the code he posted is doing (IMO).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #7
OK

Well, I only wanted to make sure that the OP didn't understand your
suggestion as a replacement for the code he posted. The OP was asking
if there is any better way to do what the code he posted is doing (IMO).

Nov 21 '05 #8
Thank you both for your posts. What Mr. Lighthert suggested was actually a
method I hadn't explored being a newbie, which I don't know if I have
mentioned that on this NG, and I actually thought multithreading would be a
lot more intensive, come to find that it only took about 3 min of reading
and 2 min of code in this situation, 5min to learn a black area per say not
bad. Also Mr. Wagner's post helped me understand that what I had been doing
was in fact a good practice that should not be discounted. Two great
insights from one thread I really appreciate it.

Corey

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
OK

Well, I only wanted to make sure that the OP didn't understand your
suggestion as a replacement for the code he posted. The OP was asking
if there is any better way to do what the code he posted is doing (IMO).


Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bughunter | last post by:
Hi, Consider this code: ---- Monitor.Pulse(oLock); Monitor.Exit(oLock); ---- If a thread was waiting on oLock then will the current thread
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...
3
by: JN | last post by:
Hello, I am trying to write a program or service that will run in the background and wait for a particular program to start, when it does I want something else to occur such as a message box. I...
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...
7
by: Bob | last post by:
Process.start("Mydoc.doc") starts Word with the file. I need to wait for Word to be closed before more code can execute in my app. How can I do this? Thanks for any help Bob
3
by: norm4h8 | last post by:
Hi! I have a question about how to create a process in such a way that it would terminate itself if its wated for input for too long. Here is the story. I have 2 different files, say R.c and...
3
by: bg_ie | last post by:
Hi, I'm starting a process as follows - Process process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = installValue + "\\Lib\\site-packages\...
9
by: erikcw | last post by:
Hi, I have a cgi script where users are uploading large files for processing. I want to launch a subprocess to process the file so the user doesn't have to wait for the page to load. What is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.