PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WDxx] Get service stopping Event
[WDxx] Get service stopping Event
Started by Peter van Vuuren, Apr., 07 2004 6:24 PM - 7 replies
Posted on April, 07 2004 - 6:24 PM
Hi,
I've made a service of a small WD app. Working OK
(doing some license update once 'a time interval').
I like to know, in my 'serviceprogram' when the service is stopped
(via whatever tool).
I try already some events (wm_close, wm_quit, wm_endsession ...) but
with No_Succes for the moment.
Some ideas?
Peter
Posted on April, 07 2004 - 7:48 PM
Hi,
I've made a service of a small WD app. Working OK
(doing some license update once 'a time interval').
I like to know, in my 'serviceprogram' when the service is stopped
(via whatever tool).
I try already some events (wm_close, wm_quit, wm_endsession ...) but
with No_Succes for the moment.
Some ideas?

Hi Peter,
we have a main thread with an empty loop for that. We start here the service thread if called as service or open a window if called as console app. In this loop we use EventWait or ThreadWaitSignal (opened or send from the ServiceHandler).
Best regards
Raimund
PS: Do you do your service with WinDev 7.5 or 8? We have some problems initializing our services with WinDev 8.

http://www.invitec.com
Posted on April, 07 2004 - 9:32 PM
Hi Raimund,
we have a main thread with an empty loop for that. We start here the service
thread if called as service or open a window if called as console app. In this
loop we use EventWait or ThreadWaitSignal (opened or send from the
ServiceHandler).
PS: Do you do your service with WinDev 7.5 or 8? We have some problems
initializing our services with WinDev 8.

I'll try to explain:
- The service is a program created with WD55 (because i have to open a WD55 analysis)
- The tools used for to make it a service are the service-installer
'instsrv.exe' and 'srvany.exe' as the service handler (free from MS)
(so not the wdservice.exe, delivered with WD, - LST38 or as a example with WD75)
- I created an app in WD75 to install, delete, change, stop & start the service
The WD55 app is an app without a window - if i use a window the wm_close is not
intercepted when stopping the service - but a loop in the project init.
Functions like EventWait() are not existing in WD55, so need something else.
The service opens a WD55 analysis, read some files and update some file once a
'time-interval'. I can not use an converted analysis because we've used some
fieldnames (stupid us) that WD75 doesn't like (field: SET), or can we overcome
this problem in a way, then i can deliver the WD7x analysis as well.
What i need is that my 'service-program' will trap that it will be stopped, so i
can do some ending updates.
TIA,
Peter
Posted on April, 08 2004 - 12:01 PM
Hi Raimund,
I'll try to explain:
- The service is a program created with WD55 (because i have to open a WD55 analysis)

Ahh, the difference here is that my service is a native one (not with SRVANY.EXE and even not with WDSERVICE.EXE)
The WD55 app is an app without a window - if i use a window the wm_close is not
intercepted when stopping the service - but a loop in the project init.
Functions like EventWait() are not existing in WD55, so need something else.
The service opens a WD55 analysis, read some files and update some file once a
'time-interval'. I can not use an converted analysis because we've used some
fieldnames (stupid us) that WD75 doesn't like (field: SET), or can we overcome
this problem in a way, then i can deliver the WD7x analysis as well.
What i need is that my 'service-program' will trap that it will be stopped, so i

A way would be to use WinDev 7 with an analsis without your problem table and then use a Data Source for that table.
Raimund

http://www.invitec.com
Posted on April, 08 2004 - 9:42 PM
Raimund,
A way would be to use WinDev 7 with an analsis without your problem table and
then use a Data Source for that table.

Not yet finished, but coming far (HDeclare ...)
Thanks,
Peter
Posted on April, 09 2004 - 3:50 PM
Peter,
we are using WD7.5 and WD5.5 together.
We use hdeclare, and works fine.
Pro's:
No conversion needed of the WD5.5 analyse
Works on each analyseversion of the WD5.5, when updating your WD5.5 analyse, this programm stil works. (if no items are deleted)
Cons:
Everywhere where you use files,
you have to use "EXTERN" to disable the warnings.
To access WD5.5 files in WD7.5 you can use the following code:
Sorry, the documentation is in Dutch.
// -------------------------- start code ------------------
lsAlleBestanden is string // alle bestanden vanuit hlistfile()
lsEenBestand is string // een bestand geëxtract van lsAlleBestanden
liOffSetBestand is int // OffSet van het bestand (tellertje dus)
// Herleiden van de bestandlokaties
// gsBedrijfsDir - de basis bedrijfsdirectory
// gsAnalyseNaam - volledige naam van de WinDev5.5 analyse
IF gsBedrijfsDir<>"" AND fDir(gsBedrijfsDir,frDirectory)<>"" THEN
// teller resetten
liOffSetBestand =1
// ophalen van alle bestanden uit WinDev5.5 analyse
lsAlleBestanden =HListFile(gsAnalyseNaam)
LOOP
// Per bestand gegevens verwerken
lsEenBestand =ExtractString(lsAlleBestanden,liOffSetBestand,CR)
// Einde bereikt, er zijn geen bestanden meer
IF lsEenBestand=EOT THEN
BREAK
END
// Het bestand kenbaar maken aan dit project
HDeclare(lsEenBestand,gsAnalyseNaam)
// Teller naar volgende bestand zetten
liOffSetBestand++
END
// Na het kenbaar maken van alle bestanden in dit project, kunnen alle normale hyperfile-functies gebruikt worden.
// Dus gaan we eerst met HSubstdir, de locatie wijzigen
HSubstDir(BasisDir,gsBedrijfsDir)
ELSE
gsBedrijfsDir =""
END
// -------------------------- end code ------------------
You can also convert your analyses to 7.5,
and synchronize your analyses with WD5.5 analyse.
You have to update your converted analyses,
everytime you change the WD5.5 analyse (automatic synchronisation).

greetings,
Joop
Member of the Dutch speaking WinDev developer group (WDG)

Raimund,
A way would be to use WinDev 7 with an analsis without your problem table and
then use a Data Source for that table.
Not yet finished, but coming far (HDeclare ...)

Thanks,
Peter



New-Way Automation b.v.
Posted on April, 09 2004 - 5:12 PM
Hi Joop,
we are using WD7.5 and WD5.5 together.
We use hdeclare, and works fine.
Pro's:
No conversion needed of the WD5.5 analyse
Works on each analyseversion of the WD5.5, when updating your WD5.5 analyse, this programm stil works. (if no items are deleted)
Cons:
Everywhere where you use files,
you have to use "EXTERN" to disable the warnings.
To access WD5.5 files in WD7.5 you can use the following code:
Sorry, the documentation is in Dutch.

[...]
No problem with that :-).
Thanks for the code.
(BTW, is it really necessary to use 'EXTERN'?, seems to be working without ...)
Greetings,
Peter
ps: saw a few weeks ago an ex-colleague of mine, now some sort of concurrent
of you - AdJ from EBP - on an AFAS meeting :-))
Posted on April, 09 2004 - 5:35 PM
Peter,
Everything is working fine without EXTERN,
you only get warnings on all file-items because the files are unknown for your project.
I make a .WL file with and in my projectopening I use this file using "EXTERN Files.WL".
Files.WL looks like:
EXTERN filename1
EXTERN filename2
EXTERN filename3

greetings,
Joop
Member of the Dutch speaking WinDev developer group (WDG)

Hi Joop,
we are using WD7.5 and WD5.5 together.
We use hdeclare, and works fine.
Pro's:
No conversion needed of the WD5.5 analyse
Works on each analyseversion of the WD5.5, when updating your WD5.5 analyse, this programm stil works. (if no items are deleted)
Cons:
Everywhere where you use files,
you have to use "EXTERN" to disable the warnings.
To access WD5.5 files in WD7.5 you can use the following code:
Sorry, the documentation is in Dutch.
[...]

No problem with that :-).
Thanks for the code.
(BTW, is it really necessary to use 'EXTERN'?, seems to be working without ...)
Greetings,
Peter
ps: saw a few weeks ago an ex-colleague of mine, now some sort of concurrent
of you - AdJ from EBP - on an AFAS meeting :-))



New-Way Automation b.v.