By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

Process.Start() blocking?

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.