473,499 Members | 1,691 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 3319
"Nick" <no****@altavente.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' EnableRaisingEvents property?
Armin
Nov 21 '05 #2
"Nick" <no****@altavente.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 'EnableRaisingEvents' 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****@altavente.com> wrote in message
news:ec**************@tk2msftngp13.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**************@TK2MSFTNGP10.phx.gbl...
"Nick" <no****@altavente.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 'EnableRaisingEvents' 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
2582
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
8162
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...
77
4503
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...
18
4852
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)...
7
10131
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
4721
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...
8
3197
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....
12
3079
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...
4
2244
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...
0
7134
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
7014
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...
0
7180
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,...
0
7229
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...
1
6905
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...
0
7395
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
4609
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...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
311
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...

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.