Run Harbour application as a windows service

402 views
Skip to first unread message

Tim Stone

unread,
Feb 9, 2016, 7:10:31 PM2/9/16
to Harbour Users
I have visited this question before ... but have not been successful.

I have an application used to perform automated processes.  It is created with harbour and MSVC++ 2013.  As a standalone it runs without a problem.  Because there is no user interface, or display of data, it runs quietly in the background and can continue for days.

Normally I could just put this into the Startup folder on a server, but that does not get enacted until someone logs into the server.  So I need to have it run as a windows service.

I have been able to register it as a service, using the documented information ( recommended ) for srvstart.exe.  It then does install and shows on the service list.  Apparently some have had success with this.

When I try to start the service, I get a system error 1067.  In previous testing it appeared that the program needs to return some value when it is started or the service manager will abort it.

Does anyone here have experience creating apps with Harbour to run as a windows service ?  If so, do I need to include something in my program code so it will be successful ?

Thank you for looking at this and any responses.

Tim

Daniele Campagna

unread,
Feb 10, 2016, 11:04:30 AM2/10/16
to harbou...@googlegroups.com
Years ago -many- I found a nice piece of software: app2service.exe.
It creates a service and puts in it your program. That's all.

If you can't find it googlig around I maybe have a copy somewhere.
Let me know if that can solve your problem.
Dan

Tim Stone

unread,
Feb 10, 2016, 12:41:49 PM2/10/16
to Harbour Users, cyber...@tiscalinet.it
I tried AppToService ( which is apparently the same program renamed to avoid a conflict ).  Yes, it will load the program as a service, and it actually logs it as running, but it isn't.
I use Actual Installer for distributing my programs, and it also will register the program as a service.  However, the service will not do anything.
I also have used windows SC to install it, but that gets me the error.

All of this would make me believe that there is a problem with the program, but if I run it directly, it works perfectly and has no failures. 

This is a multi-step program which repeats every 3 hours.  It does log to a database.  It uses FTP to download some files, and to upload some files.  It also unzips some files.  That is it.  There is no UI, There is no console output.

It is a puzzle.  Any thoughts would be helpful. 

Tim


Qatan

unread,
Feb 10, 2016, 1:03:57 PM2/10/16
to harbou...@googlegroups.com
 
Hello Tim,
 
What about running it without any GT?
It will be there but doesn’t show anything...
I did it once by mistake and the effect was more or less as you described but in my case it was undesirable.
Just an idea.
 
Qatan
 

Tim Stone

unread,
Feb 10, 2016, 1:33:30 PM2/10/16
to Harbour Users

There is no graphical component.  I do link in FWH for the database component ( data objects ),   However, there are no calls to anything graphical.

Ron Christie

unread,
Feb 11, 2016, 1:06:04 AM2/11/16
to Harbour Users
Hi Tim,

Have you looked at how Letodb does their Windows service implementation? I personally haven't used the Windows service component (but I have used it in Linux as a daemon), perhaps it could help.

Cheers,
Ron

oleksa

unread,
Feb 11, 2016, 4:45:49 AM2/11/16
to harbou...@googlegroups.com, Harbour Users
Hi!

Letodb? Better look at hbnetio, option -i (install as service (requires admin rights)").

Best regards,
Alexey Myronenko

11 лютого 2016, 08:06:08, від "Ron Christie" <ronald.b...@gmail.com>:

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Baxajaun

unread,
Feb 11, 2016, 5:12:35 AM2/11/16
to Harbour Users
Dear Tim,

what Windows's version do you use ?

Thanks !

Best regards,

Baxajaun

unread,
Feb 11, 2016, 6:02:51 AM2/11/16
to Harbour Users
Reply all
Reply to author
Forward
0 new messages