That was great stuff. Thanks!
The one thing that I can use immediately is combining the two EXEs into one, but how can I run the non-service form if the service is already running? Will it have to shutdown the running service before it can continue with the non-service form?
UPDATE: If I run the the non-service after the service is already running, then I get two services running. Was this to be expected?
I tried closing the first service by putting this in the INIT of the form, but it doesn't Stop it.
IF m.THISFORM.oShellApp.IsServiceRunning(.ServiceName)
m.THISFORM.oShellApp.ServiceStop(.ServiceName, .F.)
ENDIF
>Jay:
>
>I have been following your posts about creating a service with VFP. Maybe I can give you some advice.
>
>You have to use srvany.exe because it is not possible to write a program that acts as a service with VFP alone. You could also use another activeX control or method, but srvany.exe works and is free.
>
>You can get srvany as part of the Windows Server 2003 Resource Kit Tools. There is a comprehensive help file included that explains how it should be used.
>
>Basically when a program runs as a service, it interacts with the service control manager. The SCM tells a service to start, stop, pause, and resume, and can query a service status.
>
>srvany.exe acts as a middle man between the Service Control Manager and our VFP exe.
>
>You do NOT need instsrv.exe, you can do what it does yourself, in the VFP program. And you can even include srvany.exe inside the vfp exe and extract it the first time your program is run.
>
>A good strategy is to create only one executable, that will act as the service exe itself, and as a monitoring/control/config program for the service.