System.Diagnostics.Process.Start problem when the process is already running

B

Bob Trabucco

Hello all,

Here is my delemma...

Dim objProcess as System.Diagnostics.Process =
System.Diagnostics.Process.Start(x)

With objProcess
.WaitForExit()
.Close()
End With

Works great in most cases. It opens up the document in the associated
program and waits for it to exit - just like I need it to.

Now the problem. I try to use this to open up a Microsoft Word Document. I
have Word already running or Outlook or some other program that uses Word.

The Start returns Nothing because it just attached to a running process! My
application really needs to know when the user is done with the document.

Anybody know of a way I could determine they closed the document if the
system just used and existing process?

Thanks in advance,

Bob
 
G

Guest

Hey Bob,

By chance do you find a resolution to your problem? I'm facing the same
issue and was thinking that forcing the computer to start a 2nd process would
be the answer but I haven't really seen any resolutions to this problem on
the www. I would appreciatte any assistance you can give. Or better yet
since I'm a MSDN Universal Subscriber maybe Microsoft will have a good answer
within a couple of days.

THANKS
 
B

Bob Trabucco

Hey Ken,

What I ended up doing was if the Process.Start returned nothing then I
entered a loop that attempts to open the file exclusively - if that failed I
know it was still in use.

Ugly I know

A better solution is still apprectiated.

Bob
 
G

Guest

WOW, Thanks for the quick response. I do agree that is an ugly way in doing
it. I'll keep trying and if I find a better way I'll make sure I'll post it.

THANKS again for the info!
 

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