本文介绍了您如何检查进程是否正在运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我想编写一个简单的程序来检查某个进程,如果该进程正在运行,则会出现一个消息框.这是到目前为止我得到的,但是没有显示消息框.
Hi, I want to make a simple program that checks for a process and if it is running a messagebox will appear. Here is what I got so far but it doesn''t show the messagebox.
private void Form1_Load(object sender, EventArgs e)
{
foreach(Process pro in Process.GetProcesses("notepad")) {
if( pro.ProcessName.Contains("notepad"))
{
MessageBox.Show("hi");
}
感谢您提前提供帮助.
Thanks for the help in advance.
推荐答案
这篇关于您如何检查进程是否正在运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!