467,076 Members | 910 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

Process.Start() blocking?

Hello NG,

I'm need to write some code which creates tiff files from various
document types (doc, pdf, xls). I want to do this by ShellExecuting
(via System.Diagnostics.Process) the doc-files with the "print"-verb.
This works for me. However, I need to handle the case when a printing
application
doesnt't quit in a given timespan (for example a password-protected
word-document). So I've tried the following:

1. I start the shell-exec vie Process.Start() (with "UseShellExec =
true").
2. I start a thread which sleeps a give timespan and then checks
whether the shell-exec process is still alive.
3. If the shell-exec process is still alive it gets "killed".

In the case of one excel file, this approach wont work because the
Process.Start() function is blocking. This is what happens:
A call to Process.Start() "starts" the .xls. Excel opens, prints and
wants to quit. Before quitting, it displays a
"Do-you-want-to-save?"-dialog.
The Process.Start() function won't return unless the Dialog gets closed
(manually). How can that be? I thought Process.Open() works asynchronly

(it does in all other case). I can't start the "killer-thread" bedore
calling Process.Start(), becuase the Process-object can't be used
before the Start()-method has returned.

Could anyone explain to me why Process.Start() behaves this way? Is
there any way to make my approach work?

Thanks in advance
Henning

Dec 16 '05 #1
  • viewed: 1883
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Stephen.Haeney | last post: by
7 posts views Thread by Bob | last post: by
11 posts views Thread by garyusenet@myway.com | last post: by
2 posts views Thread by jrm | last post: by
31 posts views Thread by Nikos Chantziaras | last post: by
12 posts views Thread by =?Utf-8?B?ZXAu?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.