c# interactiveProcessRunner
Can someone tell me what the InteractiveProcessRunner
is for? Is it identical to Process.Start
?
Here is the class.
And here an example :
InteractiveProcessRunner runner =
new InteractiveProcessRunner(notepad.e开发者_Python百科xe,hSessionToken);
THX
Whit this class you can run a process with the complete environment of the user active: if you call this code from a service, you should find the user mapped resources, the desktop and all the resources that are available when the user is loggen on interactively even if launched from a service ie not logged interactively.
The source code to which your link leads referes to this article: http://asprosys.blogspot.com/2009/03/perils-and-pitfalls-of-launching.html which explains the motivation behind it.
Summary: You can't really use Process.Start()
when you want to start a new process as certain user from a windows service. The InteractiveProcessRunner
lets you do this (supposedly, never used it so I can't verify it). So it's not the same as Process.Start()
- it uses a different Windows API.
精彩评论