Page 1 of 1
A Service Monitor application
Posted: Thu Feb 18, 2010 9:59 am
by rdonnay
Brian Wolfsohn suggested that I write a Service Monitor application that is a small shell used to load another application.
This was done to try to get around the problems of not being interactive under Win3002 server.
The idea is that the small app would be loaded as a service and it would constantly monitor to see if the main app is running.
If it isn't then it starts it with RunShell(). The app to run is defined in SERVMON.INI.
I have a problem with this, because it appears that RunShell() won't allow me to call another Xbase++ program from an app that is running as a service.
I have attached the code.
Any ideas?
Re: A Service Monitor application
Posted: Mon Feb 22, 2010 9:09 am
by bwolfsohn
rdonnay wrote:Brian Wolfsohn suggested that I write a Service Monitor application that is a small shell used to load another application.
This was done to try to get around the problems of not being interactive under Win3002 server.
The idea is that the small app would be loaded as a service and it would constantly monitor to see if the main app is running.
If it isn't then it starts it with RunShell(). The app to run is defined in SERVMON.INI.
I have a problem with this, because it appears that RunShell() won't allow me to call another Xbase++ program from an app that is running as a service.
I have attached the code.
Any ideas?
Roger,
You might want to send this out on the xbase list also.. There might be someone outside of express++ who's done this already.. Mabe even boris..
Brian
Re: A Service Monitor application
Posted: Tue Feb 23, 2010 4:43 pm
by Pablo Botella
Hi Roger,
Hector was point me out about this issue.
I don't have the source of DC_IsAppRunning() but I can imagine you are using the windows class and title with FindWindow() or FindWindowEx() to locate the main window of the program.
The trouble is that the service even loged-on with the same user/pwd is running in a diferent WindowsStation/Desktop and you windows are not visible through diferent desktops, however this is not a big trouble as you can check if a process is runing using the PsAPI functions.
The other issue is that RunShell() don't allow to specify the WindowsStation/Desktop so the new process will be run in a noninteractive WindowsStation.
Will be not so mutch complex to implement this monitor properly, however it will need to invest some working time, so if you need it just send me a private email and I will give you a quote for this task.
Regards,
Pablo Botella