Why not use the intended class in your installer:

private System.ServiceProcess.ServiceInstaller serviceInstaller1;
serviceInstaller1.StartType=System.ServiceProcess.ServiceStartMode.Manual;

Marcus


-----Ursprungligt meddelande-----
Från: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] För Arlie Davis
Skickat: den 12 december 2003 19:58
Till: [EMAIL PROTECTED]
Ämne: Re: [ADVANCED-DOTNET] ServiceProcess and ServiceController

Do NOT do this.  Direct modification of the SCM registry keys is a very,
very bad idea, because it gets the registry out of sync with the SCM
itself.  This has nothing to do with managed vs. unmanaged code.  This
is simply the rules for using the SCM.

The best way (and it's fairly easy) is to write a small wrapper around
the SCM API.  The easiest way is to write it in Managed C++, and expose
the functionality as a managed class.  This is at most a day's work.
Then you can use the managed classes from C#, VB, whatever.

-- arlie


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Chad M. Gross
Sent: Friday, December 12, 2003 8:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] ServiceProcess and ServiceController


For simplicity, you could always resort to modifying the registry Start
value under the service key you are interested in and change it to one
of the int values of the ServiceStartMode enum.  There are two other
values missing from the enum but those are for driver services only.

Chad

On Thu, 11 Dec 2003 12:34:20 -0600, Gautama, Damon
<[EMAIL PROTECTED]> wrote:

>Hello,
>I am trying to programmatically change the Startup Type for Services,
>and
disable/enable Devices. The ServiceController class makes it possible to
Start, Stop, Continue, and Pause, but I am looking to go a little more
permanent (Disable/Enable/Manual for Services).
>
>Is there a way to do this though the .NET framework, or do I have to
>use
interop and go back to OpenSCManager, etc?
>
>Thanks,
>damon
>
>===================================
>This list is hosted by DevelopMentorR  http://www.develop.com Some .NET

>courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorR  http://www.develop.com Some .NET
courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor.  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to