Re: ocx in opo

From: Robert Hoskin <rhoskin_at_heartlnd.com>
Date: 1996/08/14
Message-ID: <4usngd$31v_at_news.inforamp.net>#1/1


Uwe Harmening wrote:
>
> Hello,
>
> who has made experiences with ocx-controls in power objects? I need a
> timer ocx (16bit) to include into a programm and trigger events every 5
> minutes. Alternatively I would need a piece of code providing this job
> (beeing a timer) without the need of an endless loop that takes lots of
> resources.
> Please help
> Thank you
> Jui
> jui_at_internet.de

Jui,

An OCX may work for you, but if all you need is a timer, I'd suggest you put one in TestCommand(). OPO calls the TestCommand() method many times a second. It's not an endless loop per se, but for your purposes it acts like one.
Inside TestCommand(), use the TIMER() function to get a seconds-past-midnight count and use a STATIC variable to store seconds-since-last-look. Then, IF enough seconds have passed, call a user-defined method or do your periodic task directly.

TestCommand() is called so often that it probably provides much more timer granularity than you need, so you can save some overhead by using a  CASE or IF to check for a particular command code and only check your timer when that code is present.

Hope this helps...

Bob Hoskin
Heartland Software Received on Wed Aug 14 1996 - 00:00:00 CEST

Original text of this message