我有一个程序,安装服务,而我希望能够给用户选择稍后更改启动类型设置为自动。
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.