Article View: borland.public.csharpbuilder.language.csharp
Article #677Re: writng Win32service in BorlandC#Builder How do I do it?
From: J.A Smit
Date: Mon, 25 Oct 2004 07:19
Date: Mon, 25 Oct 2004 07:19
79 lines
3689 bytes
3689 bytes
Thanks for reply,
Ok to elaborate a little on where I am.
I found the following example in the SDK docs witch I customised a litttle:
------- Code excerpt Begin-----------
using System;
using System.ServiceProcess;
public class MyService : System.ServiceProcess.ServiceBase
{
}
public MyService()
{
this.Servicename = "KoersTracker";
this.CanStop = true;
this.CanPauseAndContinue = true;
this.Autolog = true;
}
public static void Main()
{
System.ServiceProcess.ServiceBase.Run(new MyService());
}
protected override void OnStart(string[] args)
{
//Insert code here to define processing.
}
------- Code excerpt End -----------
When I build this get an error at "public class JurService :
System.ServiceProcess.ServiceBase" it says :"Expected
class,delegate,enum,interface or struct".
It seems like the class isn't recognised.
Maybe important to know, I created the project as a C# Appllication. I
stripped everything from the main source file and inserted the code found
above.
I also found some stuff on ProcessInstaller and ServiceprocessInstaller do I
put it in the same sourcefile?(I think not).
The main problem I have is:
How do I build the project, file wise. As far as I can see now, you need:
A sourcefile with the subclass of ServiceBase and a handler for the OnRun
method.
A sourcefile witch controls installation of the service (do I also need the
ServiceProcessInstaller class when I install only one service?
Still unclear:
I wanted to build(compile) the project in this state of progress just to see
if I got the syntax right, but the error I got leads me to assume there's
already a syntax problem.
I don't know what you mean by "you will need to spawn a thread........" what
is ment with "thread" in this context?
What files will I eventually have (or need) in the project?
Again thanks for reply, I hope this mail makes it a little more clear where
I'm coming from....
Alex
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:hyra00h6xyiu$.dlg@marcrohloff.40tude.net...
> On Sun, 24 Oct 2004 20:10:51 +0200, J.A Smit wrote:
>
> > Hi all,
> > I'm trying to write a win service that collects some data from the www
net
> > and then stores this data.
>
> Its a bit hard to tell how far you are. Generally you start by
> creating a subclass of the ServiceBase class and overriding the
> methods you need. Generally you will need to spawn a thread to do the
> work and control it from ServiceBase's methods.
>
> --
> Marc Rohloff [TeamB]
> marc rohloff at myrealbox dot com
Technical Details
Message-ID:
<417ca911$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<417bf043$1@newsgroups.borland.com> <hyra00h6xyiu$.dlg@marcrohloff.40tude.net>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,a97d3f9f5adb9274 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "J.A Smit" <alex.zoem@wanadoo.nl> Newsgroups: borland.public.csharpbuilder.language.csharp References: <417bf043$1@newsgroups.borland.com> <hyra00h6xyiu$.dlg@marcrohloff.40tude.net> Subject: Re: writng Win32service in BorlandC#Builder How do I do it? Date: Mon, 25 Oct 2004 09:19:06 +0200 Lines: 81 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 212.129.129.221 Message-ID: <417ca911$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098688785 212.129.129.221 (25 Oct 2004 00:19:45 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail