Timed Repeat for my Application

G'day,

I have written an application which is working well. Up until now, I have executed it using the Task Scheduler within windows but circumstances have dictated that a different solution be required.

What I want is really quite simple (I hope!) I would like the application to execute on startup (it runs silently in the background with no user input or visualization at all) which I can cover by adding an HKLM registry key as part of the finished msi package. What I require the application to do is repeat every 5 minutes. I want this for two reasons:

1. I am informed that the program will run more reliably if the program doesn't exit and restart every 5 minutes using the Task Scheduler. I am also informed that this will be more efficient on the memory of the destination PC's as the program loads once and sits idle when not used.

2. The Task Scheduler option provides difficulties when installing the msi onto several machines as I cannot get it to install and hold the correct setting in the .job file in the System32\Tasks folder. The runas part in particular likes to change itself!

As such, I want the program to run as normal, then at the end, rather that the Application.Exit() closing the program, I would like to scrap this part and have the program wait 5 minutes before going back to the start again to run. How do I accomplish this please !


BA



Answer this question

Timed Repeat for my Application

  • DeveloperMCT

    A couple of questions.

    1.) Why the concern with an msi file

    2.) How are you using "startup" Do you mean boot or logon



  • wuboyan

    Have you considered converting this into a windows service That would take care of the issues of authentication and being able to run unattended. You would just include a timer which fires an event every 5 minutes triggering your methods to start running.

    If you were only firing your application daily or hourly, I would be more inclined to go the Scheduler option. With it this frequent, a windows service may well be better.

    Jim Wooley
    http://devauthority.com/blogs/jwooley/default.aspx



  • jen0s

    Thanks, but I have now got the timer to work on this.

    Due to the current network settings we have in place, when installing the msi through a Group Policy Object (GPO) on a Organisational Unit (OU) of computers, the computers that are contained in the OU install the software but do not push out the relevant sheduled task - this is likely to be because of a mistake on my part in the msi building application I am using (it was free after all!)

    To start the program I add the following registry key file as part of the GPO install:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
    "RunRMCVBApp"="C:\\WINDOWS\\system32\\RMC.exe"

    This forces the program to launch on startup and now that I have the timer working, (I hadn't dragged one on to the form, that made it much easier!) the program launches and sits in the background re-running once every 5 minutes.

    Thanks Guys and Galls!

    BA

  • Timed Repeat for my Application