473,625 Members | 2,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10156
Hi,

Did you try Application.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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.f orms 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.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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.f orms 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.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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.f orms 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.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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.Exi t to be called.
Willy.

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

Did you try Application.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:DB******** *************** ***********@mic rosoft.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.f orms
> 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.App licationExit event?
> >
> > cheers,
> >
> > --
> > Ignacio Machin,
> > ignacio.machin AT dot.state.fl.us
> > Florida Department Of Transportation
> >
> >
> >
> > "yaron" <ya***@discussi ons.microsoft.c om> wrote in message
> > news:7D******** *************** ***********@mic rosoft.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.Exi t to be called.
Willy.

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

Did you try Application.App licationExit event?

cheers,

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

"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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
6083
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 uses message queues to pass pointers to Events between threads. In my app there are simple events that can be defined using an enum (for example an event called NETWORK_TIMEOUT) and more complex events that contain data (for example an event called...
7
1937
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 reset at all? Is this a bug? I've attached an HTML page to reproduce the behaviour. Bye, Peter.
1
3247
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 B, but since B has modal dialogs up, it doesn't close. I don't want to send a Process.Kill because then the user would not have the option of saving (or not saving) on exit. Thanks, J
5
1890
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) Save cmbMyCombo's event handler for SelectedIndexChange event. 2) Assign a temporary event handler sub to cmbMyCombo's for its SelectedIndexChange event.
5
3605
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 event, others, no... I manage to have the list of events with EventInfo, but I'm unable to see if some event has a handler associated...
8
9037
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 tgt like this:
2
2069
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. Is there a way to disable the b event inside the procedure for handling the a event? Is there another approach I should consider?
2
3909
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 well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
3
1057
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
8182
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
8635
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
8352
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
8494
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
7178
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...
1
6115
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
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
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.