C#做的系统服务如何调用explorer运行?//代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.IO;namespace Windows_Server
{
public partial class Mylock : ServiceBase
{
string sname = "explorer"; public Mylock()
{
InitializeComponent();
} protected override void OnStart(string[] args)
{
stat();
} protected override void OnStop()
{ }
public void stat()
{
Process[] proces = Process.GetProcessesByName(sname);
foreach (Process proce in proces)
{
if (proce.ProcessName == sname)
{ }
else
{
Thread trd = new Thread(qdcx);
trd.Start();
}
}
}
public void qdcx()
{
Process.Start("explorer");
} private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
stat();
} }
}
//结果 并不能打开~~5555~
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.IO;namespace Windows_Server
{
public partial class Mylock : ServiceBase
{
string sname = "explorer"; public Mylock()
{
InitializeComponent();
} protected override void OnStart(string[] args)
{
stat();
} protected override void OnStop()
{ }
public void stat()
{
Process[] proces = Process.GetProcessesByName(sname);
foreach (Process proce in proces)
{
if (proce.ProcessName == sname)
{ }
else
{
Thread trd = new Thread(qdcx);
trd.Start();
}
}
}
public void qdcx()
{
Process.Start("explorer");
} private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
stat();
} }
}
//结果 并不能打开~~5555~
imageName: explorer.exe
http://topic.csdn.net/u/20080911/22/8b02ddc9-0a3c-497e-8a2d-7a1735bc116a.html
写全称呀:explorer.exe