Re: Process.Start & Process.Kill

Peter Ritchie <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <LISTSERV%[email protected]>
As has been mentioned, process is probably being recycled.

You're really at the mercy of the program you're executing as to whether
it implements a singleton of sorts and recycles an already running
process.  Without performing some automation on an existing process,
there's not much you can do using the Process class.  You can subscribe to
the Exited event and you'll be notified if the process you spawned was
terminated before you expected it to be (it's a good idea to subscribe to
this event in general, as the user can terminate the process you spawn and
the only other way to handle it is to catch the exception).

In the case of Acrobat Reader, you can probably do something with DDE to
get it to load a PDF file instead of executing a PDF file.  That's
essentially what the shell does...

On Thu, 22 Mar 2007 09:44:08 +0100, Graeme Hood <[email protected]> wrote:

>If I Process.Start a pdf file, I can later do Process.Kill and it closes
>fine.  If I do the same with a saved Outlook msg file, the message opens
>fine, but when I try to kill the process I get an exception because the
>process has already exited.  Can someone please explain the difference,
>and how I can best close an outlook form that I have opened?
>
>proc = Process.Start("MyPdfFile.pdf");
>proc.Kill(); <== Works fine
>
>
>proc = Process.Start("MyMessageFile.msg");
>proc.Kill(); <== Process already exited.
>
>
>Thanks for any clarification
>  <mailto:[email protected]>
>
>This email message is intended only for the use of the named recipient.
>Information contained in this email message and its attachments may be
>privileged, confidential and protected from disclosure. If you are not the
>intended recipient, please do not read, copy, use or disclose this
>communication to others. Also please notify the sender by replying to this
>message and then delete it from your system.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.