473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
1 5240
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tobias Johansson | last post by:
Hello, I'm having what I believe a security problem to execute an executable file from a windows service in windows server 2003. It works fine in WIN XP SP2 The program(the service) itself...
6
by: danl | last post by:
I need to be able to execute a .bat file from a C# web application I have the following code that compliles and seems to run fine, but the bat file never does it's work...
0
by: Scott Zabolotzky | last post by:
I'm using the following code to launch SIGNCODE.EXE to sign a CAB provisioning file from an ASP.NET app. When I run the code the exit code comes back as -1. I have not been able to determine what...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
1
by: John Crouse | last post by:
I am using the following code sucessfully on Windows 2000 and Windows XP. However, in WIndows 98 it seems to hang on the WaitForExit. What are my options here? MsgBox("Please be patient. This...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
0
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine....
2
Atli
by: Atli | last post by:
Hi o/ I decided this morning to teach myself C++ \o/... 6 hours later Im just about ready to throw in the towel :) Anyways I have a minor annoyance you good ppl might be able to help me with. ...
1
by: =?Utf-8?B?Sm9uYXRoYW4=?= | last post by:
I have WinXP Pro SP2 and VS2005 SP1. I'm converting my projects from VS2003 to VS2005 and I receive a lot of warnings in several projects. For example, to one of my projects (for example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.