473,385 Members | 1,531 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,385 software developers and data experts.

process

hi to all,

If to start a process i can use this way...

System.Diagnostics.Process.Start()

How could close a proccess in my machine? there isnt a
method like End()

Thanks in advance.
Perico.
Nov 15 '05 #1
6 2792
Hi,

try the Kill method...

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemdiagnosticsprocessclasskilltopic.
asp

Hope this helps...

Regards,
Madhu

MVP | MCSD.NET
-----Original Message-----
hi to all,

If to start a process i can use this way...

System.Diagnostics.Process.Start()

How could close a proccess in my machine? there isnt a
method like End()

Thanks in advance.
Perico.
.

Nov 15 '05 #2
Perico <an*******@discussions.microsoft.com> wrote:
If to start a process i can use this way...

System.Diagnostics.Process.Start()

How could close a proccess in my machine? there isnt a
method like End()


See Process.Kill and Process.CloseMainWindow - but you should consider
carefully before doing such a thing.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
Hi Madhu
im viewing the url that you tell me, but i dont
understand one thing...

In the msdn speaks about the anormal termination of a
program using the kill method, but i try use this method
in my visual studio editor, and i cant find the kill
method...

Im using
System.Diagnostics.Process.Kill() but the visual studio
dont recognize this...

Probably im using the msdn in a wrong way. Could you give
me an advice about this?

Thanks Madhu.
Regards.
Perico

-----Original Message-----
Hi,

try the Kill method...

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemdiagnosticsprocessclasskilltopic ..asp

Hope this helps...

Regards,
Madhu

MVP | MCSD.NET
-----Original Message-----
hi to all,

If to start a process i can use this way...

System.Diagnostics.Process.Start()

How could close a proccess in my machine? there isnt a
method like End()

Thanks in advance.
Perico.
.

.

Nov 15 '05 #4
You need the instance of a process to call its kill method

System.Diagnostics.Process.GetCurrentProcess().Kil l();
System.Diagnostics.Process.GetProcessesByName("MyP rocess").Kill();

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #5
Hi Perico,

Note that the Kill method of Process class is not a
static method that is the reason why

System.Diagnostics.Process.Kill() doesn't show in Visual
Studio.

Hope this helps...

Regards,
Madhu

MVP | MCSD.NET
-----Original Message-----
Hi Madhu
im viewing the url that you tell me, but i dont
understand one thing...

In the msdn speaks about the anormal termination of a
program using the kill method, but i try use this method
in my visual studio editor, and i cant find the kill
method...

Im using
System.Diagnostics.Process.Kill() but the visual studio
dont recognize this...

Probably im using the msdn in a wrong way. Could you giveme an advice about this?

Thanks Madhu.
Regards.
Perico

-----Original Message-----
Hi,

try the Kill method...

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemdiagnosticsprocessclasskilltopi
c..
asp

Hope this helps...

Regards,
Madhu

MVP | MCSD.NET
-----Original Message-----
hi to all,

If to start a process i can use this way...

System.Diagnostics.Process.Start()

How could close a proccess in my machine? there isnt a
method like End()

Thanks in advance.
Perico.
.

.

.

Nov 15 '05 #6
I was a bit fast there. GetProcessesByName returns an array of processes
so the line should read

System.Diagnostics.Process.GetProcessesByName("MyP rocess")[0].Kill();

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #7

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

Similar topics

1
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
11
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new...
6
by: Michael J. Moore | last post by:
Is it the listener process, or some other Oracle process. Also, on a UNIX system, when you do "ps -ef" to see your processes, the PPID points back to a process named "init". Why does the PPID not...
12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
77
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...
6
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external...
10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
5
by: GTS | last post by:
Hi All, I am spawning a process from a service. The spawned process hungs for various reasons, (corrupted data, deadlock). I am expecting the process has to complete the task with in the...
11
by: Jon Davis | last post by:
Does anyone know why using System.Diagnostics.Process to "wrap" a console application does not always transmit the I/O, depending on what processes you're trying to "consume"? PowerShell, for...
4
by: =?Utf-8?B?U3Jhag==?= | last post by:
There is a process A that launches process B as a COM object. If the User tries to end process A, process B should also end. But vice versa is not true. Process A can run independant of process. It...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.