如果检测到进程,执行某些操作 [英] Do something if process is detected

查看:72
本文介绍了如果检测到进程,执行某些操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我使用我的代码,它说我的代码中不存在进程吗?是否有我不知道的新代码?请帮帮我



  if (Process.GetProcessesByName(  RobloxPlayerBeta.exe)。长度>  < span class =code-digit> 0 )
{
System.Threading.Thread.Sleep( 4000 );
textBox2.Text + = \ r \\\
欢迎来到AL7!
;
textBox2.Update();
textBox2.Text + = \\\\ nLoading Lua环境。;
textBox2.Update();
textBox2.Text + = \\ nnLua状态失败。;
textBox2.Update();
}





我的尝试:



  if (Process.GetProcessesByName( < span class =code-string> RobloxPlayerBeta.exe)。长度>   0 
{
System.Threading.Thread.Sleep( 4000 );
textBox2.Text + = \ r \\\
欢迎来到AL7!
;
textBox2.Update();
textBox2.Text + = \\\\ nLoading Lua环境。;
textBox2.Update();
textBox2.Text + = \\ nnLua状态失败。;
textBox2.Update();
}

解决方案

这与进程名称与图像名称相同非常不同......

例如notepad.exe的进程名称(这是映像名称)是记事本...



所以你可能需要写你的行像这个:

  if (Process.GetProcessesByName(  RobloxPlayerBeta)。长度>   0 < /跨度>)


Hi can someone help me with my code it says process does not exist in my code it used to work is there new code I dont know about? please help me

if (Process.GetProcessesByName("RobloxPlayerBeta.exe").Length > 0)
           {
               System.Threading.Thread.Sleep(4000);
               textBox2.Text += "\r\nWelcome to AL7!";
               textBox2.Update();
               textBox2.Text += "\r\nLoading Lua environment.";
               textBox2.Update();
               textBox2.Text += "\r\nLua state failed.";
               textBox2.Update();
           }



What I have tried:

if (Process.GetProcessesByName("RobloxPlayerBeta.exe").Length > 0)
           {
               System.Threading.Thread.Sleep(4000);
               textBox2.Text += "\r\nWelcome to AL7!";
               textBox2.Update();
               textBox2.Text += "\r\nLoading Lua environment.";
               textBox2.Update();
               textBox2.Text += "\r\nLua state failed.";
               textBox2.Update();
           }

解决方案

It is very unlike that the process name is the same as image name...
For instance the process name for notepad.exe (this is the image name) is notepad...

So you probably have to writ your line like this:

if (Process.GetProcessesByName("RobloxPlayerBeta").Length > 0)


这篇关于如果检测到进程,执行某些操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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