In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

My TaskScheduler as a service ....

Xailer professional forum in English
Responder
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

My TaskScheduler as a service ....

Mensaje por ChrisGillard »

Hi,

I have a Xailer TaskScheduler program that is very successful and I am trying converting it to run as a service.

All is going well and it appears to run as a service 95% OK, except for my Timer function when it wants to actually execute the task .... calling my RunNow() method.

My problem is how to run the required .exe from within my program running as a service.

The 'non service' code that works fine is this

METHOD RunNow() Class ScheduledTask

Execute( ::cFile, FilePath( ::cFile ) )

RETURN( self )

This would work fine with ::cFile = "c:\windows\system32\notepad.exe" ..... notepad pops up on the PC main window in the usual way.

Problem is it appears to not do anything visible when executed from a service.

So question is :

1. Can I execute a program from a Xailer service program to appear on the PC main window ... I really hope so!
2. What is the function to do this, possibly ShellExecute or ????

Any help would be appreciated.

Thanks

Chris
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: My TaskScheduler as a service ....

Mensaje por ignacio »

Hi,

1) I believe is not possible, sorry.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

Re: My TaskScheduler as a service ....

Mensaje por ChrisGillard »

Oh dear, thats not what I wanted to hear.

Is this something to do with how Xailer has implemented the service code ?

There are some other 3rd party Task Schedulers that do run as services and can launch exes plus of course Windows own Task Scheduler.

I can see that Microsoft would want it to be difficult to do because of worries of malware, virus etc.

Oh dear, I was very pleased with my code, but its not much use now.

If you get a 'eureka' moment and can see how to do it, please let me know.

Chris
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: My TaskScheduler as a service ....

Mensaje por ignacio »

ChrisGillard escribió:Oh dear, thats not what I wanted to hear.

Is this something to do with how Xailer has implemented the service code ?

There are some other 3rd party Task Schedulers that do run as services and can launch exes plus of course Windows own Task Scheduler.

I can see that Microsoft would want it to be difficult to do because of worries of malware, virus etc.

Oh dear, I was very pleased with my code, but its not much use now.

If you get a 'eureka' moment and can see how to do it, please let me know.

Chris
2017-11-13 18_16_28-Introduction to Windows Service Applications _ Microsoft Docs.png
2017-11-13 18_16_28-Introduction to Windows Service Applications _ Microsoft Docs.png (14.82 KiB) Visto 3594 veces
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

Re: My TaskScheduler as a service ....

Mensaje por ChrisGillard »

Hi Ignacio,

Thanks for continuing with this.

I was fairly aware about that no interaction was possible.

The applications I want to run are things like night time 'batch jobs', written in Harbour that do not interact with the screen but just do various 'housekeeping' jobs and when finished they just exit.

Maybe my example of notepad.exe was a bad one.

I have not actually tried to run one of our Harbour 'batch jobs'.

I will have a go and see.

Regards

Chris
Responder