>>> Did you tried ON SHUTDOWN? <<
>
>Yeah I have tried that as well. What I want to do is write a VFP COM object that runs as a service. I was hoping that the SYS(2340) function would allow me to do that natively from VFP without using a 3rd party tool. For some reason I can not capture the Start/Stop/Pause events from NT using just VFP.
>
>I have written several VFP NT services using a 3rd party control and they work, but I wanted to get rid of the 3rd party control and go to VFP completely. I was hoping some of the features in VFP7 would allow me to do that. What I am seeing is it is not possible to create NT services from VFP without using a 3rd party tool.
>
>Thanks,
>Dale
FWIW, I believe you still need the 3rd party tool (as you found out). What SYS(2340) does is make sure VFP stays running even if the current user logs out.
What previously happened was the service would start and everything would be okay until a user logged into the system. When they logged out, the VFP service application would shutdown. SYS(2340) intercepts the logoff message and depending on the setting, ignores it so your application continues to run. It will still terminate if a shutdown message is detected, but only then.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao