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
ChrisGillard
Posts: 384
Joined: Tue May 01, 2007 5:49 pm

My TaskScheduler as a service ....

Postby ChrisGillard » Mon Oct 30, 2017 11:41 pm

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
User avatar
ignacio
Site Admin
Posts: 8555
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: My TaskScheduler as a service ....

Postby ignacio » Tue Oct 31, 2017 5:39 pm

Hi,

1) I believe is not possible, sorry.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
ChrisGillard
Posts: 384
Joined: Tue May 01, 2007 5:49 pm

Re: My TaskScheduler as a service ....

Postby ChrisGillard » Fri Nov 10, 2017 6:41 pm

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
User avatar
ignacio
Site Admin
Posts: 8555
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: My TaskScheduler as a service ....

Postby ignacio » Mon Nov 13, 2017 6:17 pm

ChrisGillard wrote: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) Viewed 1328 times
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
ChrisGillard
Posts: 384
Joined: Tue May 01, 2007 5:49 pm

Re: My TaskScheduler as a service ....

Postby ChrisGillard » Tue Nov 14, 2017 1:39 pm

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

Return to “English”