NetTalk Central

Author Topic: Implementing SelfService  (Read 3172 times)

rupertvz

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Implementing SelfService
« on: March 25, 2015, 01:14:46 PM »
Hi Guys,

I added the SelfService template to one of my apps.
This application used to run with the "NT-service" template.  It is a very small app, I am hiding the application window and it already has a text-file log feature built into it.

Launching MyService /iss
The service installs, but immediately gives a message that the services is not running;
The log file however shows the entries, and the application did what it was supposed to do.

Should it loop automatically?  Or should I built in a loop?
(I had previously used NT-service which included a loop option)

* It seems to start, run the application, then ends .. hence the reason it says "service did not start"?






Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Implementing SelfService
« Reply #1 on: March 25, 2015, 09:56:26 PM »
Hi Rupert,

If you run the program as an exe does it just run once and end? If so that's what it'll do when it runs as a service.
If you want it to stay alive and do something over and over then you need to code it to do that - presumably using a timer event on the window.

>> Should it loop automatically? 

no

>> Or should I built in a loop?

if you want it to stay alive and perform some task, then yes, you program it to do that.

>> (I had previously used NT-service which included a loop option)

Sounds like NT-Service is a "wrapper" of sorts that altered the program behavior. SelfService doesn't do that - SS turns your program into a service, after that it does whatever it is you programmed the program to do.

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Re: Implementing SelfService
« Reply #2 on: March 26, 2015, 01:25:11 AM »
Thanks Bruce,

I am using a source procedure as a "main" procedure, thus no window structure, or procedural timer.

I have in the meantime used a loop procedure with the "sleep" function ... not sure if this is good practice? Sustainable?

Hiding or having no procedure windows worked better for me using NT-Service.

Does it make a difference in Self-Service whether I use / hide procedure-windows from display?


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Implementing SelfService
« Reply #3 on: March 26, 2015, 06:56:02 AM »
Hi Rupert,

I've not used sleep myself, but I suppose it's ok.
Personally I'd just make a window, put a timer on it, and then put my code in the timer.
It doesn't matter if you hide the window or not - either way the user is not going to see it.
I leave mine "not hidden" so when the program runs as an exe then you can see it.

cheers
Bruce