Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当任何用户登录到系统时,如何使用windows服务在其会话中打开notepad.exe?_C# - Fatal编程技术网

C# 当任何用户登录到系统时,如何使用windows服务在其会话中打开notepad.exe?

C# 当任何用户登录到系统时,如何使用windows服务在其会话中打开notepad.exe?,c#,C#,我想创建一个windows服务,当任何用户登录到系统时,该服务将自动将notepad.exe触发到他的用户会话中。使用此服务: Process notePad = new Process(); notePad.StartInfo.FileName = "notepad.exe"; notePad.StartInfo.Arguments = "textFileToDisplay.txt"; notePad.Start(); 亲爱的,我已经试过你的代码,也试过CreateProcess函数的D

我想创建一个windows服务,当任何用户登录到系统时,该服务将自动将notepad.exe触发到他的用户会话中。

使用此服务:

Process notePad = new Process();
notePad.StartInfo.FileName   = "notepad.exe";
notePad.StartInfo.Arguments = "textFileToDisplay.txt";
notePad.Start();

亲爱的,我已经试过你的代码,也试过CreateProcess函数的DllImport,CreateProcessWithLogonW函数,还使用了Microsoft.Win32.TaskScheduler功能,但所有功能都不起作用。有人能解决我的问题吗。Windows服务在开发模式下打开记事本,但当我使用installUtil运行Windows服务时,它不会打开记事本。启动进程的服务不会显示GUI。记事本显示的是任务管理器