Click here to Skip to main content
15,445,316 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi, I am unable to kill the process when using process.start() and We are getting multiple tabs open for one process in some times only. I am using TAPI3 application. plz find the below link.

TAPI 3.0 Application development using C#.NET[^]

Please help me!!

Thanks!

What I have tried:

if (url != "")
            {
                Process pr = new Process();
                pr.StartInfo.FileName = url;
                pr.Start();
                foreach (var p in Process.GetProcessesByName(url))
                {
                    p.Kill();
                    addtolist("Process killed");
                }
                Thread.Sleep(10);
            }
Posted
Comments
Richard MacCutchan 7-Feb-20 4:19am    
Use your debugger to find out what is getting returned from the call to GetProcessesByName. You can also use Task Manager to check that the process is running and its name matches the URL.
Richard Deeming 7-Feb-20 5:41am     CRLF
Why would you start a process if you're immediately going to kill it? If that's really what you're trying to do, then use:
pr.Start();pr.Kill();
Dave Kreskowiak 7-Feb-20 8:44am     CRLF
GetProcessesByName is never going to find a URL. It will work with the executable name you find in Task Manager though. Also, you are probably trying to kill a process that hasn't even started yet. Process.Start does not wait for the process to actually start before it returns. But, the question remains, why would kill a process immediately after launching it? There's no point to it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900