473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with System.Diagnost ics.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.InvaidOp erationExceptio n
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.UseSh ellExecute = false; I get a
System.Componen tModel.Win32Exc eption ("%1 is not a valid Win32 application").

//*************** code snip *************** ***
Process myP = new Process();
myP.StartInfo.A rguments = "help.hhp";
myP.StartInfo.F ileName = "hhc.exe";
myP.StartInfo.C reateNoWindow = true;
myP.Start();
myP.WaitForExit ();

--

Any suggestions besides ignoring the InvalidOperatio nException?

Thanks
Paul
Nov 16 '05 #1
1 5278
Yep, check myP.HasExited before running WaitForExit.

--
John Wood
Blog: http://dotnetjunkies.com/weblog/johnwood
"PaulFir509 " <Pa********@dis cussions.micros oft.com> wrote in message
news:BF******** *************** ***********@mic rosoft.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.InvaidOp erationExceptio n
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.UseSh ellExecute = false; I get a
System.Componen tModel.Win32Exc eption ("%1 is not a valid Win32
application").

//*************** code snip *************** ***
Process myP = new Process();
myP.StartInfo.A rguments = "help.hhp";
myP.StartInfo.F ileName = "hhc.exe";
myP.StartInfo.C reateNoWindow = true;
myP.Start();
myP.WaitForExit ();

--

Any suggestions besides ignoring the InvalidOperatio nException?

Thanks
Paul

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3194
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 just continues as if nothing where wrong after process.Start is executed and I get an Exit code from the process
6
2200
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 =================================== System.Diagnostics.Process p = new Process() p.StartInfo.RedirectStandardOutput=false p.StartInfo.FileName = "C:\\ftp_scripts\\script.bat" p.StartInfo.UseShellExecute=true p.Start() p.WaitForExit() p.Dispose();
0
1694
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 this exit code means (other than Error, as the CAB file does not get signed). No exceptions are thrown and I've verified that the app can read and write to the c:\mps\provdata directory. It seems as if it's not a permissions problem as the...
1
5974
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 am executing the find.exe program. The application works perfectly in the development environment. As soon as I execute the compiled program and start the find process I get an "Application Error". The error states that the instruction...
1
1590
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 operation could take a minute or two to complete.", MsgBoxStyle.Information, "CPViewer") Me.Cursor = Cursors.WaitCursor Dim p As New System.Diagnostics.ProcessStartInfo
11
3744
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 simple batch file (echo hello world) and was trying to retrieve the standard output but every time I run the code it returns ExitCode as 1.
0
1798
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. anything to do different for windows server 2003? some special permission for the process that executes another executable with System.Diagnostics.Process.Start ?? here is the code:
2
4379
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. I created a simple code to open a .exe file in C# wich work fine (all hail C# :P) System.Diagnostics.Process proc;
1
2050
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 MyProject.vbproj) I receive the following result in the command prompt: Build succeeded: .... .... (a lot of warnings)
0
8402
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.