Page 1 of 1

Creating a Windows Service in HMG

Posted: Tue Aug 10, 2010 4:33 pm
by melliott42
Hello,

How can I create a Windows service using HMG?


Thanks,

Michael

Re: Creating a Windows Service in HMG

Posted: Tue Aug 10, 2010 5:06 pm
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

Re: Creating a Windows Service in HMG

Posted: Tue Aug 10, 2010 5:17 pm
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

Re: Creating a Windows Service in HMG

Posted: Tue Aug 10, 2010 6:36 pm
by mol
If I remember, Grigori Filatov presented some apps working as service. Maybe he will answer?

Re: Creating a Windows Service in HMG

Posted: Wed Aug 11, 2010 1:42 pm
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-)

Re: Creating a Windows Service in HMG

Posted: Thu Aug 26, 2010 1:23 am
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...