views:

791

answers:

2

In a Windows Forms application I kill a process like this:

    Process[] ps = Process.GetProcessesByName("DataWedge");
    foreach (Process p in ps)
        p.Kill();

How can I do it in the Windows Mobile operating system?

(This sample doesn't work on Windows Mobile.)

+2  A: 

You need to enumerate the Processes running on the device in order to get it's process ID. Once you've got the processId you can just do:

Process process Process.GetProcessById(processId);
process.Kill();

Here's an article that deals with enumerating the processes, it also includes a kill example as well.

GenericTypeTea
thank's for the help, but how i can know the processID that i need ?
Gold
You need to check the enumeration by the process name.
GenericTypeTea
sorry about the ignorance...... how to do it ? can i get sample C# code for this ?
Gold
Look at the article I provided.
GenericTypeTea
i try, but it dont work on windows mobile 2005 i get exceptionCode: 0x80000002 and ExceptionAddress: 0x02e07084
Gold
0x80000002 == OutOfMemeory. Sounds like you probably have a recursion bug in your code.
ctacke
A: 

Try this link

Shadow