易语言如何判断进程!如何知道进程是否存在!

易语言如何知道QQ是否在运行!如果没有运行提示对话框!谁能告诉哦!!!!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello world");

if (!check_ntbackup(startcmd("tasklist")))
{
start_job();
}

Console.ReadLine();
}
public static string startcmd(string command)
{
string output = "";
try
{
//实例化一个进程类
Process cmd = new Process();

//获得系统信息,使用的是 systeminfo.exe 这个控制台程序
cmd.StartInfo.FileName = command;

//将cmd的标准输入和输出全部重定向到.NET的程序里

cmd.StartInfo.UseShellExecute = false; //此处必须为false否则引发异常

cmd.StartInfo.RedirectStandardInput = true; //标准输入
cmd.StartInfo.RedirectStandardOutput = true; //标准输出

//不显示命令行窗口界面
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

cmd.Start(); //启动进程

//获取输出
//需要说明的:此处是指明开始获取,要获取的内容,
//[color=#FF0000]只有等进程退出后才能真正拿到[/color]
output = cmd.StandardOutput.ReadToEnd();
Console.WriteLine(output);
cmd.WaitForExit();//等待控制台程序执行完成
cmd.Close();//关闭该进程
}
catch (Exception e)
{
Console.WriteLine(e);
}
return output;
}
public static string startcmd(string command ,string argument)
{
string output = "";
try
{
//实例化一个进程类
Process cmd = new Process();

//获得系统信息,使用的是 systeminfo.exe 这个控制台程序
cmd.StartInfo.FileName = command;
cmd.StartInfo.Arguments = argument;
//将cmd的标准输入和输出全部重定向到.NET的程序里

cmd.StartInfo.UseShellExecute = false; //此处必须为false否则引发异常

cmd.StartInfo.RedirectStandardInput = true; //标准输入
cmd.StartInfo.RedirectStandardOutput = true; //标准输出

//不显示命令行窗口界面
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

cmd.Start(); //启动进程

//获取输出
//需要说明的:此处是指明开始获取,要获取的内容,
//[color=#FF0000]只有等进程退出后才能真正拿到[/color]
output = cmd.StandardOutput.ReadToEnd();
Console.WriteLine(output);
cmd.WaitForExit();//等待控制台程序执行完成
cmd.Close();//关闭该进程
}
catch (Exception e)
{
Console.WriteLine(e);
}
return output;
}
public static bool check_ntbackup(string output_from_command)
{
return output_from_command.Contains("ntbackup.exe");
}
public static void start_job()
{
DateTime dt = new DateTime();
string num = dt.Day.ToString();
string jobname = "Day" + num;

string commond = "schtasks.exe ";
string argument = " /run /tn " + jobname;
//Console.WriteLine(commond );
startcmd(commond,argument);
}
}
}

//不会易语言,只有自己用c#写的判断ntbackup.exe进程的希望对你有用
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-10-30
加个 “超级模块” 版本4.0以上

进程是否存在(“QQ.exe”)

他会返回真或假

代码:

.版本 2

.如果真 (进程是否存在 (“QQ.exe”) = 假)
信息框 (“没有!”, 0, )本回答被提问者和网友采纳
第2个回答  2010-11-01
判断进程是否存在就可以
第3个回答  2010-10-30
下载模块 如果没有就HI我 一般就是 进程名取ID 取到空的话就说明没有

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网