467,136 Members | 1,330 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

Problem with System.Diagnostics.Process and WaitForExit

I am attempting to run the HTML help compiler from within another application.
When I get to the WaitForExit call, I get a System.InvaidOperationException
and a message "No process associated with this object." Is it just finishing
before I make the call? The process seems to finish (I have a compiled and
working help.chm).

If set StartInfo.UseShellExecute = false; I get a
System.ComponentModel.Win32Exception ("%1 is not a valid Win32 application").

//***************code snip ******************
Process myP = new Process();
myP.StartInfo.Arguments = "help.hhp";
myP.StartInfo.FileName = "hhc.exe";
myP.StartInfo.CreateNoWindow = true;
myP.Start();
myP.WaitForExit();

--

Any suggestions besides ignoring the InvalidOperationException?

Thanks
Paul
Nov 16 '05 #1
  • viewed: 4668
Share:
1 Reply
Yep, check myP.HasExited before running WaitForExit.

--
John Wood
Blog: http://dotnetjunkies.com/weblog/johnwood
"PaulFir509" <Pa********@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
I am attempting to run the HTML help compiler from within another
application.
When I get to the WaitForExit call, I get a
System.InvaidOperationException
and a message "No process associated with this object." Is it just
finishing
before I make the call? The process seems to finish (I have a compiled and
working help.chm).

If set StartInfo.UseShellExecute = false; I get a
System.ComponentModel.Win32Exception ("%1 is not a valid Win32
application").

//***************code snip ******************
Process myP = new Process();
myP.StartInfo.Arguments = "help.hhp";
myP.StartInfo.FileName = "hhc.exe";
myP.StartInfo.CreateNoWindow = true;
myP.Start();
myP.WaitForExit();

--

Any suggestions besides ignoring the InvalidOperationException?

Thanks
Paul

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by danl@drawnet_no_spam.com | last post: by
reply views Thread by Scott Zabolotzky | last post: by
1 post views Thread by solex | last post: by
1 post views Thread by John Crouse | last post: by
Atli
2 posts views Thread by Atli | last post: by
1 post views Thread by =?Utf-8?B?Sm9uYXRoYW4=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.