473,406 Members | 2,259 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,406 software developers and data experts.

Is there is any event handler for process kill event ?

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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.

Nov 17 '05 #1
7 10120
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.

Nov 17 '05 #2
Hi Ignacio Machin,

I am writing C# Console application and not WinForms application, because i
saw that the application class is part of the syste.windows.forms namespace.
i tried to use it in console application and it didn't work.

thanks.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.


Nov 17 '05 #3
Add a reference to System.Windows.Forms.dll to get access to the Application
class.

Brendan
"yaron" wrote:
Hi Ignacio Machin,

I am writing C# Console application and not WinForms application, because i
saw that the application class is part of the syste.windows.forms namespace.
i tried to use it in console application and it didn't work.

thanks.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.


Nov 17 '05 #4
Hi Brendan Grant,

I already did it (add reference), and it didn't work.

thanks.
"Brendan Grant" wrote:
Add a reference to System.Windows.Forms.dll to get access to the Application
class.

Brendan
"yaron" wrote:
Hi Ignacio Machin,

I am writing C# Console application and not WinForms application, because i
saw that the application class is part of the syste.windows.forms namespace.
i tried to use it in console application and it didn't work.

thanks.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
> 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
> the cleanup code will be call from my main thread and not from any other
> thread.
>
> thanks.
>

Nov 17 '05 #5
This event is not raised as a result of a 'kill' command, note also that
Console applications can't use this event either, only applications that
have a message loop can register for this event, and the event is fired as a
result of Application.Exit to be called.
Willy.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.


Nov 17 '05 #6
There is nothing yu can do when a process gets killed ( a result of a
ApplicationExit call), the process simply disappears without any possibility
to execute any code.

Willy.

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:DB**********************************@microsof t.com...
Hi Brendan Grant,

I already did it (add reference), and it didn't work.

thanks.
"Brendan Grant" wrote:
Add a reference to System.Windows.Forms.dll to get access to the
Application
class.

Brendan
"yaron" wrote:
> Hi Ignacio Machin,
>
> I am writing C# Console application and not WinForms application,
> because i
> saw that the application class is part of the syste.windows.forms
> namespace.
> i tried to use it in console application and it didn't work.
>
> thanks.
>
>
> "Ignacio Machin ( .NET/ C# MVP )" wrote:
>
> > Hi,
> >
> > Did you try Application.ApplicationExit event?
> >
> > cheers,
> >
> > --
> > Ignacio Machin,
> > ignacio.machin AT dot.state.fl.us
> > Florida Department Of Transportation
> >
> >
> >
> > "yaron" <ya***@discussions.microsoft.com> wrote in message
> > news:7D**********************************@microsof t.com...
> > > 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
> > > the cleanup code will be call from my main thread and not from any
> > > other
> > > thread.
> > >
> > > thanks.
> > >
> >
> >
> >

Nov 17 '05 #7
Hi Willy Denoyette,

so if i understand you, the one and only option for console app is to put my
cleanup code in ~MyClass() ?

Thanks.
"Willy Denoyette [MVP]" wrote:
This event is not raised as a result of a 'kill' command, note also that
Console applications can't use this event either, only applications that
have a message loop can register for this event, and the event is fired as a
result of Application.Exit to be called.
Willy.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Did you try Application.ApplicationExit event?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"yaron" <ya***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
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
the cleanup code will be call from my main thread and not from any other
thread.

thanks.



Nov 17 '05 #8

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

Similar topics

8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
7
by: Peter Adolphs | last post by:
Hi newsgroup! The W3C HTML 4.01 recommendation states that "The onreset event occurs when a form is reset." Using Mozilla 1.4.1, how come that if I set onreset="return false;", the form is not...
1
by: Joshua T. Moore | last post by:
If application A sends a Process.Close message to application B, is there an event handler in application B to handle it? The problem is that application A sends the close message to application...
5
by: Richard Grant | last post by:
Hi, I need to "save" in a variable the event handler sub of a control's event, then perform some process, and finally "restore" the originally saved event handler. Example in pseudo-code: 1)...
5
by: Charles Bazi | last post by:
Hi, I have a base UserControl named UserControlEx. I have created an event, and a dummy handler. Then I create several UCs with UserControlEx base. Some of those have a handler for my custom...
8
by: moondaddy | last post by:
I'm working in WPF and c# and am adding an event handler to an object like this: this.tgt.SizeChanged += new SizeChangedEventHandler(OnTargetSizeChanged); Later I kill the instance of...
2
by: =?Utf-8?B?TWF4IDFlNg==?= | last post by:
I have two events (a and b) each with its own handler. Unfortunately, event b is sometimes trigered by an action within a's handler causing a's handler to abort prematurely and service the b event....
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
3
by: Curious | last post by:
Hi, I have a program that gets the prices of stocks in real-time. The program consists of the following key components: // Constructor public GetRealTimeStockPrice() { // Step 1
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.