Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: Converting working Win32 app to Windows Service - using TServerSocket

www.cryer.info
Managed Newsgroup Archive

Re: Converting working Win32 app to Windows Service - using TServerSocket

Subject:Re: Converting working Win32 app to Windows Service - using TServerSocket
Posted by:"Warrick Wilson" (warri..@cwwilson.com)
Date:Wed, 21 Nov 2007 11:36:52

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:4743ca42@newsgroups.borland.com...
>
> "Warrick Wilson" <warrick@cwwilson.com> wrote in message
> news:47432c64$1@newsgroups.borland.com...
>
>
> I strongly suggest you not use OnExecute at all.  In fact, you don't even
> need it.  Most of your code is better suited for the OnStart and
> OnStop/Shutdown events anyway.  For example:
>
> [example snipped]
>
> TService has its own LogMessage() method that logs to Windows's own Event
> Log.
>

Gambit - Outstanding! I reworked the code as you outlined, and it's working.
Sadly, I don't know _why_ it's working. When you say "Most of your code is
better suited for the OnStart and  OnStop/Shutdown events anyway", how did
you know that? What should I be reading that would explain this? Most of
what I saw with my search results basically said "you can do either/or".
It's obviously important - if I'd started with something similar to what you
suggested in your reply, I'd have missed an opportunity for learning. So is
there something I can read to get a better handle on this? I have to convert
a couple more applications (since we'd like our new system to run
automatically without needing someone/some account signed in) AND some of
the new apps have a UI (kiosk display sort of thing).

Thanks again!

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive