473,788 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process.Exit event not being raised

Hi there,

I'm running a process object within a .NET app, very simple, the process
is declared with events, i'm handling the Exit event and running a win32
application. No matter how the process closes the event is never raised, is
this because it is a win32 app rather than .NET? I've tried closing,
killing, and even sending a WM_CLOSE event to the window, it closes but no
event is raised.

My only other solution was to keep monitoring the HasExited property on
a background thread but I would rather use the event as that is what it was
created for. Thanks in advance if anyone has any advice on this!

--
Nick Pateman

---------------------------------------------------------------
Any views expressed above are my own
Without predjudice
Nov 21 '05 #1
4 3329
"Nick" <no****@altaven te.com> schrieb
Hi there,

I'm running a process object within a .NET app, very simple, the
process
is declared with events, i'm handling the Exit event and running a
win32 application. No matter how the process closes the event is
never raised, is this because it is a win32 app rather than .NET?
I've tried closing, killing, and even sending a WM_CLOSE event to
the window, it closes but no event is raised.

My only other solution was to keep monitoring the HasExited
property on
a background thread but I would rather use the event as that is what
it was created for. Thanks in advance if anyone has any advice on
this!

Did you set the process' EnableRaisingEv ents property?
Armin
Nov 21 '05 #2
"Nick" <no****@altaven te.com> schrieb:
I'm running a process object within a .NET app, very simple, the
process is declared with events, i'm handling the Exit event and running a
win32 application. No matter how the process closes the event is never
raised, is this because it is a win32 app rather than .NET? I've tried
closing, killing, and even sending a WM_CLOSE event to the window, it
closes but no event is raised.


Make sure your process object's 'EnableRaisingE vents' property is set to
true. Alternatively you can start a new thread which starts the other
application and calls the process object's 'WaitForExit' method afterwards.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Hi there,

Not to worry, I'm calling the WaitForExit method in a separate thread to
get around the problem.

Nick.

"Nick" <no****@altaven te.com> wrote in message
news:ec******** ******@tk2msftn gp13.phx.gbl...
Hi there,

I'm running a process object within a .NET app, very simple, the
process is declared with events, i'm handling the Exit event and running a
win32 application. No matter how the process closes the event is never
raised, is this because it is a win32 app rather than .NET? I've tried
closing, killing, and even sending a WM_CLOSE event to the window, it
closes but no event is raised.

My only other solution was to keep monitoring the HasExited property on
a background thread but I would rather use the event as that is what it
was created for. Thanks in advance if anyone has any advice on this!

--
Nick Pateman

---------------------------------------------------------------
Any views expressed above are my own
Without predjudice

Nov 21 '05 #4
Hi Herfried,

Sorry for the delay my pc only got the message today! Anyway's not to
worry now as I have a nice working solution :-) Thanks for your and Armin's
help.

Nick.

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
"Nick" <no****@altaven te.com> schrieb:
I'm running a process object within a .NET app, very simple, the
process is declared with events, i'm handling the Exit event and running
a win32 application. No matter how the process closes the event is never
raised, is this because it is a win32 app rather than .NET? I've tried
closing, killing, and even sending a WM_CLOSE event to the window, it
closes but no event is raised.


Make sure your process object's 'EnableRaisingE vents' property is set to
true. Alternatively you can start a new thread which starts the other
application and calls the process object's 'WaitForExit' method
afterwards.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

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

Similar topics

1
2601
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
2
8222
by: T | last post by:
How do you catch the "Exited" event when a process is terminated. In the following code sample the "myProcess_Exited" event is never called. Any help would be appreciated. using System; using System.Diagnostics; using System.Threading; class ConsoleProcessApp { public static void Main()
77
4613
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the process starts is not especially important, but it must be complete within a small number of seconds. The operations I am performing do not take a long time (hundreds of milliseconds), but as each part of the process is complete, my worker thread...
18
4893
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE) p.stdin.write("hostname\n") however, it doesn't seem to work. I think the cmd.exe is catching it.
7
10186
by: yaron | last post by:
Hi, I am looking for doing this : void OnKillProcess() { do Cleanup; } i don't want to use ~MyClass() (or Finalize), because i wan't that
19
4758
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
8
3228
by: Lonifasiko | last post by:
Hi, Using Process class I asynchronously launch an executable (black box executable) file from my Windows application. I mean asynchronously because I've got an EventHandler for "Exited" event. Therefore, when process finishes, "Exited" event is raised. This executable writes a long file for over 1-5 minutes, and I, from my application must read that file while is being generated.
12
3112
by: kimiraikkonen | last post by:
Hi there, There is a problem about progress bar; although the "progressbar1.visible = True" is present for my invisible "progressbar1" control to make visible when button1 is clicked, before execution of my external process, it appears after the external process finishes processing. And my main and only form (form1) cannot be interacted while external process is processing. How can i get rid of it? Here is the code:
4
2259
by: tdahsu | last post by:
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should start five threads and process five files at a time. Is this a good idea? I picked the number five at random... I was thinking that I might check the number of processors and start a multiple of that, but then I remembered KISS and it seemed that...
0
9656
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
10374
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
10177
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
10121
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
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
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.