🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Programming a TService

#14143
From: Markus Schadegg
Date: Fri, 29 Aug 2003 14:31
30 lines
2091 bytes

Hi,

trying to write my first Service...

1) How can a service terminate itself
(due to an error, for example)?
Searching for something like Application->Terminate()

2) Is a Service always started in the Windows-Directory 
(GetCurrentDir() == "C:\\WINNT\\SYSTEM32", for example)?

3) How can I debug a service? 
Yep, I have tried to do what the online help tells me to do:
  I have set the Registrykey and I have checked 'Allow Service to Interact with Desktop' in the service manager.

But it still does not work correctly...
The windows service manager loads BCB.EXE, but BCB shows the following Error(translated from german:'Fehler beim Laden der Typbibliothek'):

'Error loading type library C:\TEST\TESTSERVICE.EXE'

Even tried to set the commandline option -d in the Registry key
Debugger... I can now debug a little bit, but without my project settings... And... after a few seconds, the service manager kills BCB.EXE including my service... so after about half minute, the game is over... 

4) What kind of response is the windows service manager waiting for? If it does not get such a response, it kills my service...

Thanks for any help.

Markus Schadegg
Technical Details
Message-ID: <3f4f63ab$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,dc8a5f42ff15bb2f,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-29 07:39:05 PST
From: "Markus Schadegg" <schadegg@gmx.de>
Sender: "Markus Schadegg" <schadegg@gmx.de>
Reply-To: "Markus Schadegg" <schadegg@gmx.de>
Subject: Programming a TService 
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 80.128.163.28 80.128.163.28    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f4f63ab$1@newsgroups.borland.com>
Date: 29 Aug 2003 07:31:07 -0700
X-Trace: newsgroups.borland.com 1062167467 207.105.83.65 (29 Aug 2003 07:31:07 -0700)
Lines: 32
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail