开发者

c# interactiveProcessRunner

开发者 https://www.devze.com 2023-02-20 16:16 出处:网络
Can someone tell me what the InteractiveProcessRunner is for? Is it identical to Process.Start? Here is the class.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消