从服务启动应用程序
|
我想通过service.c运行用c#winform制作的应用程序,我已经完成了代码,但是即使服务成功启动也不会启动该应用程序,也不会引发异常。
protected override void OnStart(string[] args)
{
eventLog1.WriteEntry(\"starting Kb\");
try
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = @\"C:\\Program Files (x86)\\Invisual E. Inc\\KeyboardSetup\\keyboard.exe\";//Exe Path
myProcess.StartInfo.CreateNoWindow = false;
myProcess.EnableRaisingEvents = true;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProcess.Start();
ProcessWindowStyle ws = myProcess.StartInfo.WindowStyle;
if (ws == ProcessWindowStyle.Hidden)
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
eventLog1.WriteEntry(\"started\");
}
catch (Exception c)
{
eventLog1.WriteEntry(c.Message);
}
}
日志文件不显示任何异常。
目的是在窗口的欢迎屏幕上启动应用程序,以便用户可以使用定制的键盘。
没有找到相关结果
已邀请:
2 个回复
荤碗
澜悍景哭苟