Creating a Windows Service in HMG

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Creating a Windows Service in HMG

Post by melliott42 »

Hello,

How can I create a Windows service using HMG?


Thanks,

Michael
User avatar
apais
Posts: 441
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF, Leto, MariaDB, SQLite
Location: uruguay
Contact:

Re: Creating a Windows Service in HMG

Post by apais »

A windows service by definition has no user interface.
So you don't need HGM to create it.
Harbour alone is enough for that.

HTH
Angel
Angel Pais
Web Apps consultant/architect/developer.
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Creating a Windows Service in HMG

Post by melliott42 »

That is great news - thanks Angel.

1. Are there any xHarbour examples of an app destined to be a service?
2. Are there any special initialization requirements?
3. How would a HMG\xHarbour program list or install itself as a service along with all the other common services?

I am a service creation newbie. :-)

Thanks again,

Michael
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Creating a Windows Service in HMG

Post by mol »

If I remember, Grigori Filatov presented some apps working as service. Maybe he will answer?
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Creating a Windows Service in HMG

Post by gfilatov »

melliott42 wrote:That is great news - thanks Angel.

1. Are there any xHarbour examples of an app destined to be a service?
2. Are there any special initialization requirements?
3. How would a HMG\xHarbour program list or install itself as a service along with all the other common services?

I am a service creation newbie. :-)
Hello Michael,

There is the following old sample service.prg in my code's collection (look at attachment).

Hope that helps but I don't tried this code because I've used a Harbour compiler 8-)
Attachments
service_pack.zip
xHarbour example
(4.55 KiB) Downloaded 422 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
nassausky
Posts: 21
Joined: Wed Nov 18, 2009 4:41 pm

Re: Creating a Windows Service in HMG

Post by nassausky »

Oh thanks for the code. I tried copying that into a new project file and replaced the Main.prg with everything in the service.prg file. Then I tried to compile it and got this in the error log:


hbmk2: Processing: spack.hbc
Harbour 2.0.0 (Rev. 13372)
Copyright (c) 1999-2010, http://www.harbour-project.org/
C:/hmg.3.0.35/PROJECTS/Spack/main.prg: In function 'ServiceExecutionThread':
C:/hmg.3.0.35/PROJECTS/Spack/main.prg:351: warning: dereferencing 'void *' pointer
C:/hmg.3.0.35/PROJECTS/Spack/main.prg:351: error: request for member 'pSymbol' in something not a structure or union
C:/hmg.3.0.35/PROJECTS/Spack/main.prg: In function 'AddToMessageLog':
C:/hmg.3.0.35/PROJECTS/Spack/main.prg:441: warning: format '%d' expects type 'int', but argument 4 has type 'DWORD'
C:/hmg.3.0.35/PROJECTS/Spack/main.prg: In function 'GetLastErrorText':
C:/hmg.3.0.35/PROJECTS/Spack/main.prg:692: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'DWORD'
hbmk2: Error: Running C compiler. 1
gcc.exe -c -O3 -march=i586 -mtune=pentiumpro -fomit-frame-pointer -O3 -Wall -W -IC:/hmg.3.0.35/harbour/include -IC:/hmg.3.0.35//include -IC:/hmg.3.0.35/PROJECTS/Spack -IC:/hmg.3.0.35/PROJECTS/Spack/ main.c C:\Users\Owner\AppData\Local\Temp\hbmk_5gj7u2.c

Has anyone had luck making a service?
Thanks...
_________________
Sincerely,

Mike
Post Reply