[英]How to detect if a certain process is running?
I have a Windows Forms application.我有一个 Windows Forms 应用程序。 I need an if statement that if a specific procces is running, the label on my form would change color and text.
我需要一个if语句,如果特定进程正在运行,我表单上的 label 会改变颜色和文本。 Can I build an if statement that will allow me to do that?
我可以建立一个允许我这样做的if语句吗?
I've been trying我一直在努力
if (Process.GetProcessesByName("RobloxPlayerBeta").Length != 0)
but it would not work.但它不起作用。
Try this one.试试这个。
if (Process.GetProcessesByName("process_name").Length > 0)
{
// Is running
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.