Board index » delphi » TTimer component as opposed to API calls

TTimer component as opposed to API calls

To make my application run once a day automatically, I have used a timer
component which is set to 15 mins delay.

Every 15 mins I check the time, and if necessary start the main application.

What I was wondering, was whether this eats up system resources and I would be
better off using windows system commands ?

I'd be well grateful if anyone can shed any light!

Cheers,
Kelvin.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

 

Re:TTimer component as opposed to API calls


Quote
polyes...@my-dejanews.com wrote...

|To make my application run once a day automatically, I have used a timer
|component which is set to 15 mins delay.Every 15 mins I check the time,
and if necessary start the main application.What I was wondering, was
whether this eats up system resources and I would be better off using
windows system commands ?
|
|I'd be well grateful if anyone can shed any light!
|

Delphi's TTimer is in fact nothing more than an encapsulation of a standard
Windows timer, so it would only make things needlessly complicated to via
the WINAPI. A timer consumes very little system resources , and will need
the CPU's attention only briefly when it fires. Since your application
would only need to do a brief check of a counter or so, this would consume
very little
resources.

Regards,
Dirk Claessens
______________________________________________
dirk.claessens@village.#NOSPAM#uunet.be
dirk.claessens.dc@belgium.#NOSPAM#agfa.com
remove #NOSPAM#  from mailheader
______________________________________________

Re:TTimer component as opposed to API calls


Quote
polyes...@my-dejanews.com wrote:

> To make my application run once a day automatically, I have used a timer
> component which is set to 15 mins delay.

> Every 15 mins I check the time, and if necessary start the main application.

> What I was wondering, was whether this eats up system resources and I would be
> better off using windows system commands ?

> I'd be well grateful if anyone can shed any light!

If all it does is handle the OnTimer event, then it won't be using the
CPU between timer events. That's what event based programming gets you.
Check the task-manager in NT and you'll see 0% for the app.

Delphi's components are excellent wrappers of the Windows API, with only
minimal overhead. You only really need to go direct to the API for
something Delphi doesn't wrap for you.

Andrew

Re:TTimer component as opposed to API calls


There is a program called System Agent, or something like that, which could
do all that for you.

Its mainly used to determine when scandisk and defrag should be done but yo
may be able to add your app!

Quote
polyes...@my-dejanews.com wrote in message

<6kk0pk$cf...@nnrp1.dejanews.com>...
Quote
>To make my application run once a day automatically, I have used a timer
>component which is set to 15 mins delay.

>Every 15 mins I check the time, and if necessary start the main
application.

>What I was wondering, was whether this eats up system resources and I would
be
>better off using windows system commands ?

>I'd be well grateful if anyone can shed any light!

>Cheers,
>Kelvin.

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading

Other Threads