i've got a big problem with my program. I will start an external
application with one button and kill it with an other button... I
tried many things, and postet to several board, but nobody could help
me! So, i hope you can...
Maik
P.S.: Sorry for my bad English ;-)
What you want to do is make a call to the static Start method on the
Process class. This will return a Process instance you can use. When you
are done, you can call the Kill method on the Process instance to shut down
your other app.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nicholas...@exisconsulting.com
"SCH4K4L" <chaoss...@web.de> wrote in message
news:84700a8e.02120...@posting.google.com...
i can start threads without problems, but how can i kill them on an other
place in my program??? I found no way to identify and kill my previous thread...
I can start and kill them in the same function, like a button. App on - App off.
But how can i start a thread with a button and kill it with an other one?
Thanks a lot!
Maik
"Daniel O'Connell" <onyx...@attbi.com> wrote in message news:<QLHG9.1389$pN3.89@sccrnsc03>...
public class ThreadCreateExample
{
public void Main()
{
CreateThread();
KillThread();
}
public void CreateThread()
{
MyThread.Start();
}
Thread MyThread;
public void KillThread()
{
MyThread.Abort();
}
}
Granted, that code will not compile, but shows the basic issue. You will
want to preserve your thread object.
As for with a process(i'm not completly sure which your talking about), you
could do the same thing(preserve the process object that refers to that
process) or storing the Id value somewhere in your class and then calling
Process MyProcess = Process.GetProccessById(Id), passing the Id value from
the process in.