From: Desi on
Can anyone share some insight on the use of SetTimer vs. Timer Control?
My component has a lengthy initialization process.
I want the client's object creation to return asap, and I will later notify
the client when data is ready
via asynchronous call-back. Using Sub Main(), would it not be just as easy
to load a Form containing ONLY a timer control
in comparison to creating a code-only timer? I realize the implications of a
loaded Form vis a vis keeping a component loaded,
but I was going to do that by design anyway for that very purpose.

Thoughts appreciated.

Desi


From: Tom Esh on
On Mon, 6 Feb 2006 16:33:07 -0600, "Desi" <nospam(a)thanks.net> wrote:

>Can anyone share some insight on the use of SetTimer vs. Timer Control?
>My component has a lengthy initialization process.
>I want the client's object creation to return asap, and I will later notify
>the client when data is ready
>via asynchronous call-back. Using Sub Main(), would it not be just as easy
>to load a Form containing ONLY a timer control
>in comparison to creating a code-only timer? I realize the implications of a
>loaded Form vis a vis keeping a component loaded,
>but I was going to do that by design anyway for that very purpose.
>

The only difference would be resource usage for the Timer control - a
little for the ocx wrapper, more for the requisite form to host it. I
probably wouldn't add a form just to host a Timer, but folks do it all
the time. Really wouldn't be significant unless you start piling up
instances.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
From: Michael D. Ober on
The timer control is limited to 65 seconds. If you need longer times than
that, you need to use the API SetTimer function.

Mike Ober.

"Tom Esh" <tjeshGibberish(a)suscom.net> wrote in message
news:9v1gu11hjslv1c4b401pvhfp38knl3j7pf(a)4ax.com...
> On Mon, 6 Feb 2006 16:33:07 -0600, "Desi" <nospam(a)thanks.net> wrote:
>
> >Can anyone share some insight on the use of SetTimer vs. Timer Control?
> >My component has a lengthy initialization process.
> >I want the client's object creation to return asap, and I will later
notify
> >the client when data is ready
> >via asynchronous call-back. Using Sub Main(), would it not be just as
easy
> >to load a Form containing ONLY a timer control
> >in comparison to creating a code-only timer? I realize the implications
of a
> >loaded Form vis a vis keeping a component loaded,
> >but I was going to do that by design anyway for that very purpose.
> >
>
> The only difference would be resource usage for the Timer control - a
> little for the ocx wrapper, more for the requisite form to host it. I
> probably wouldn't add a form just to host a Timer, but folks do it all
> the time. Really wouldn't be significant unless you start piling up
> instances.
>
>
> -Tom
> MVP - Visual Basic
> (please post replies to the newsgroup)
>




From: Tom Esh on
On Tue, 07 Feb 2006 03:04:24 GMT, "Michael D. Ober"
<obermd.@.alum.mit.edu.nospam> wrote:

>The timer control is limited to 65 seconds. If you need longer times than
>that, you need to use the API SetTimer function.

You don't need a longer period / interval for longer times. Instead
use the timer to periodically measure the ~real~ elapsed time.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
From: Harvey Triana on
> The timer control is limited to 65 seconds. If you need longer times than
> that, you need to use the API SetTimer function.

Not always. The next sample is a timer over ten minutes... or you like

Option Explicit

Private t As Date

Private Const DELAY As Double = 10 '//minutes

Private Sub Form_Load()
t = Now
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
If Abs(DateDiff("s", t, Now)) >= DELAY Then
Timer1.Enabled = False
MsgBox "Do Something"
End If
End Sub

<Harvey Triana />
Drilling View? Developer (52 oil wells in 2005)
---------------------
Of course:
http://classicvb.org/petition/index.asp

----- Original Message -----
From: "Michael D. Ober" <obermd.@.alum.mit.edu.nospam>
Newsgroups: microsoft.public.vb.general.discussion
Sent: Monday, February 06, 2006 10:04 PM
Subject: Re: SetTimer vs. Timer Control


 |  Next  |  Last
Pages: 1 2 3
Prev: datacombo
Next: Shutdown dialog Box