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

  • Thread starter Thread starter Bob Trabucco
  • Start date Start date
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
 
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
 
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
 
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!
 
Back
Top