Article View: borland.public.cppbuilder.nativeapi
Article #15174Re: Stop and startng a service
From: Maurice Anderson
Date: Thu, 17 Jul 2003 21:34
Date: Thu, 17 Jul 2003 21:34
83 lines
3473 bytes
3473 bytes
Giuliano,
Thanks. I am not sure what I am doing when I put FSCM( 0, "MyServiceName" )
in the contructor heading. Maybe need to study up on that.
1.) What is FSCM?
2.) Is there a way to instantiate it with the new keyword?
3.) Will this code allow me to stop and start an existing service?
4.) For example, I wanted to stop and start the Tcpip service on
a Windows 2000 workstation, how would I do this?
Thanks and sorry to bug you again.
"Giuliano" <gcardinali@remove.adhoc.net> wrote in message
news:8u2ehv8kjhckfkiijvbu2pq34p6pq5607m@4ax.com...
> On Thu, 17 Jul 2003 13:10:25 -0700, "Maurice Anderson"
> <mauriceanderson@hotmail.com> wrote:
>
> >Thanks, I downloaded it. Would you happen to have any documentation on
> >using the source from the zip?
> >
> >-M-
>
> Sorry, no docs, just some snippet from my other sources...
>
> Just declare a TServiceControlManager instance, e.g., in the
> private section of your unit or form's class declaration. For
> example:
>
> class TfrmMain : public TForm
> {
> __published: // IDE-managed Components
> ....
> ....
> ....
> private: // User declarations
> TServiceControlManager FSCM;
> public: // User declarations
> __fastcall TfrmMain(TComponent* Owner);
> ....
> };
>
> The constructor for this example could be something like the
> following snippet:
>
> __fastcall TfrmMain::TfrmMain(TComponent* Owner)
> : TForm(Owner), FSCM( 0, "MyServiceName" ),
> {
> ....
> ....
> }
>
> Now you have correctly initialized the TServiceControlManager
> instance, you can send commands to (require some functionalities
> from) it.
>
> // Service start
> FSCM.start( DefaultTimeoutValue );
>
> // Service stop
> FSCM.stop( DefaultTimeoutValue );
>
> // Service pause
> FSCM.pause( DefaultTimeoutValue );
>
> // Service resume
> FSCM.resume( DefaultTimeoutValue );
>
> // Mode: auto start the service
> FSCM.set_start_type( SERVICE_AUTO_START );
>
> // Mode: start on demand for the service
> FSCM.set_start_type( SERVICE_DEMAND_START );
>
> // Service mode: the service is disabled
> FSCM.set_start_type( SERVICE_DISABLED );
>
> Hope this helps.
>
> Fell free to ask for further help.
>
> Giuliano
Technical Details
Message-ID:
<3f1715bd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <3f17020b$1@newsgroups.borland.com> <8u2ehv8kjhckfkiijvbu2pq34p6pq5607m@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,80e98d9661a7c48a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-17 14:41:00 PST From: "Maurice Anderson" <mauriceanderson@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <3f17020b$1@newsgroups.borland.com> <8u2ehv8kjhckfkiijvbu2pq34p6pq5607m@4ax.com> Subject: Re: Stop and startng a service Date: Thu, 17 Jul 2003 14:34:23 -0700 Lines: 85 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 209.179.198.80 Message-ID: <3f1715bd@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058477501 209.179.198.80 (17 Jul 2003 14:31:41 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail