🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15173

Re: Stop and startng a service

#15173
From: Giuliano
Date: Thu, 17 Jul 2003 21:06
67 lines
2702 bytes
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: <8u2ehv8kjhckfkiijvbu2pq34p6pq5607m@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <3f17020b$1@newsgroups.borland.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:10:35 PST
From: Giuliano <gcardinali@remove.adhoc.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Stop and startng a service
Date: Thu, 17 Jul 2003 23:06:35 +0200
Message-ID: <8u2ehv8kjhckfkiijvbu2pq34p6pq5607m@4ax.com>
References: <3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <3f17020b$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.152.192.189
X-Trace: newsgroups.borland.com 1058476120 213.152.192.189 (17 Jul 2003 14:08:40 -0700)
Lines: 67
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail