杀死进程 [英] Kill Process

查看:91
本文介绍了杀死进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已启动使用Adobe SDK的流程。 它遍历一个目录,并根据文件扩展名将文件转换为.pdf。

I have a process started that uses the Adobe SDK.  It iterates through a directory, and based on the file extension, it converts the file to a .pdf.

我在表单中添加了一个按钮。

I have added a button to the form.

杀死进程的代码是:

        private void button2_Click(object sender, EventArgs e)
        {
            Process[] proc = Process.GetProcessesByName("BasicIacCS");
            Console.WriteLine("Kill Button has been clicked");
                foreach (Process prs in proc)
            {
                prs.Kill();
            }
        }

流程开始后,"终止"按钮不会中断已启动的转化过程。 转换完成后,我会在输出窗口中看到已按下"终止"按钮。 然后该过程终止。

Once the process starts, the Kill button does not interrupt the conversion process that has started.  After the conversions are completed, I will see in the output window that the Kill button was pushed.  Then the process is terminated.

我正在寻找一种让Kill按钮位于转换过程之上的方法;类似于使用Shift F5停止调试器。

I am looking for a way to have the Kill button sitting above the conversion process; something like stopping the debugger with the Shift F5.

问候,

Lance




推荐答案

你是如何开始这个过程的? 在您返回主循环之前,您是否在等待该过程完成?
How are you starting the process?  Are you waiting for the process to complete before you go back to the main loop?


这篇关于杀死进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆