如何更改在.NET中的Windows服务的启动类型(安装后)?如何更改、类型、NET、Windows

2023-09-02 01:46:46 作者:触不到的梦

我有一个程序,安装服务,而我希望能够给用户选择稍后更改启动类型设置为自动。

I have a program that installs a service, and I'd like to be able to give the user the option later on to change the startup type to "Automatic".

该操作系统是XP - (的Windows API)。如果它使任何区别

The OS is XP - if it makes any difference (Windows APIs?).

我怎样才能做到这一点。NET中? C#如果可能的话! :)

How can I do this in .NET? C# if possible! :)

推荐答案

您可以使用OpenService()和ChangeServiceConfig()原生的Win32 API用于这一目的。我相信,有在课程上的 MSDN 。您可能要检查出 P /调用Interopt助理。

You can use the OpenService() and ChangeServiceConfig() native Win32 APIs for that purpose. I believe that there is some information on pinvoke.net and of course on MSDN. You might want to check out the P/Invoke Interopt Assistant.

 
精彩推荐
图片推荐