473,903 Members | 3,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Killing the c# executable

How can i control my program when someone kill it's process from the
taskmanager
my dispose script is working well if i close the program manually but
if i kill it from taskmanager its not working
how can i fix it
my dispose script is like this

protected override void Dispose(bool Disposing)
{
if (Disposing)
{
if (components != null)
{
components.Disp ose();
}
}
Process[] procuo = Process.GetProc esses();
for (int i = 0; i < procuo.Length; i++)
{
if
(procuo[i].ProcessName.Eq uals("client"))
{
procuo[i].Kill();
}
}

base.Dispose(tr ue);

}

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
6 1677
Dakkar,

What are you trying to achieve by doing this?

If you close your program from the task manager, it kills the process,
much like calling Kill on the Process class. This forces abnormal process
termination, just clearing the process out. It doesn't send a message to
the app to shut down, it just stops it, immediately.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in message
news:42******** @127.0.0.1...
How can i control my program when someone kill it's process from the
taskmanager
my dispose script is working well if i close the program manually but
if i kill it from taskmanager its not working
how can i fix it
my dispose script is like this

protected override void Dispose(bool Disposing)
{
if (Disposing)
{
if (components != null)
{
components.Disp ose();
}
}
Process[] procuo = Process.GetProc esses();
for (int i = 0; i < procuo.Length; i++)
{
if
(procuo[i].ProcessName.Eq uals("client"))
{
procuo[i].Kill();
}
}

base.Dispose(tr ue);

}

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #2
Killing a process is just that, it doesn't allow the process to run any
longer. So I don't believe you can get your destroy to run if someone kills
the process. What you can try however, is maybe move the code below into a
service that runs as the system, or launch the application that runs the
code below as a different user.

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in message
news:42******** @127.0.0.1...
How can i control my program when someone kill it's process from the
taskmanager
my dispose script is working well if i close the program manually but
if i kill it from taskmanager its not working
how can i fix it
my dispose script is like this

protected override void Dispose(bool Disposing)
{
if (Disposing)
{
if (components != null)
{
components.Disp ose();
}
}
Process[] procuo = Process.GetProc esses();
for (int i = 0; i < procuo.Length; i++)
{
if
(procuo[i].ProcessName.Eq uals("client"))
{
procuo[i].Kill();
}
}

base.Dispose(tr ue);

}

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #3
so if i cant do something like this are there anyway to make my
process invisible
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #4
Make it a service. Then the OS makes sure that you're notifed when someone
wants to shut you down.

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in message
news:42******** @127.0.0.1...
so if i cant do something like this are there anyway to make my
process invisible
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #5
So how can i make my program as a service
Sean Hedermanwrote: Make it a service. Then the OS makes sure that you're notifed when
someone wants to shut you down.

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in message news:42******** @127.0.0.1...
so if i cant do something like this are there anyway to make my
process invisible
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com[/quote:2361bec79 e]

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #6
File new Project --> Windows Service

I would suggest however, that you do some research on services first. Try
www.codeproject.com or the MDSN help file.

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in message
news:42******** @127.0.0.1...
So how can i make my program as a service
Sean Hedermanwrote:

Make it a service. Then the OS makes sure that you're notifed when
someone
wants to shut you down.

"Dakkar" <da****@sylveri a.gen-dot-tr.no-spam.invalid> wrote in

message
news:42******** @127.0.0.1...
so if i cant do something like this are there anyway to make my
process invisible
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com[/quote:2361bec79 e]

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #7

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

Similar topics

1
3729
by: Hari Prasad | last post by:
I wrote an application where I am trying to kill a parent frame with out killing the child one. I have created a frame (F1) and if I click a button on F1 I am getting a new frame (F2). Now, if I click a button on F2, I am getting updated F1. Its fine. But if I close F2, both F2 and F1 are closing. I am trying to close F2 with out closing F1, but getting mistake. Pls suggest me how I can do this.
7
2996
by: Simon Burton | last post by:
This was so easy :) Simon Burton. #!/usr/bin/env python import sys from time import sleep from poplib import *
35
3127
by: Michael Kearns | last post by:
I've been using python to write a simple 'launcher' for one of our Java applications for quite a while now. I recently updated it to use python 2.4, and all seemed well. Today, one of my colleagues noted that on her machine the launcher would complain it was missing a DLL - msvcr71.dll However, there's a very grey area concerning the redistribution of said DLL. If you've been keeping up with the dev list, and some other web
6
3477
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item) Case "Authenticated" Case "CI_CODE" Case "organisation_description" Case "location_description"
3
2854
by: Andreas | last post by:
Hi, I just created my first vb.net pocket pc application - that consists of a main dialog and an additional dialog that is defined globally like this: Dim x as New MyTestDialog As the dialog's constructor takes a lot of time to do all that is necessary, it is called only one time when the process starts - and I just call ShowDialog any time I need to display it to the user.
10
9902
by: Jacek Pop³awski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for example: os.system("someapplication.exe") and kill it, if it waits longer than let's say 100 seconds
1
1965
by: krose | last post by:
Hi Using a couple of examples on CodeProject.com I've create a nice little shell extension (adds some custom menus for proprietary file types). Everything is working fine, except I can't get it to unregistry completely itself without killing explorer. I call UnregisterAssembly and even manually remove all references to it from the registry, this prevents the menus appearing which is good and right. But I still can not actually delete...
0
1451
by: net guest via DotNetMonster.com | last post by:
Hi, i am facing a lot of problems in killing the orphan excel instances. I approached one method like killing the Excel Orphan with processID. I am getting all the Processess that are running currently through System.Diagnostics.Process ,and i am unable to judge the Excel that was created by me only(I have to leave other Excels Untouched).. The another approach WindowHandler is fine with Windows Applications but not working in Web...
6
1917
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems like a kludge having to spawn whole new processes build in socket communications and kill via explicit OS calls. I can't see that approach scaling particularly well but I guess there's no choice. Does anyone think it likely that the threading...
0
10873
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
10983
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
10500
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
9684
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
8048
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
7206
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
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4726
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
3
3324
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.