From: Karl E. Peterson on
Bob Butler has brought this to us :
> "Karl E. Peterson" <karl(a)exmvps.org> wrote...
>> on 6/30/2010, Bob Butler supposed :
>>> "Karl E. Peterson" <karl(a)exmvps.org> wrote...
>>>> Brain freeze here, I guess.
>>>>
>>>> I need a simple one-shot timer (non form-based). I was thinking, just
>>>> use SetTimer, then call KillTimer in the callback. But, KillTimer fails
>>>> in the callback. LastDllError=0.
>>>
>>> works for me;
>>
>> You made me re-examine a few things, including where I was calling
>> KillTimer. I had been syncing the callback in a BAS module, then
>> redirecting to a class, and doing a few other things as well. Anyway, it
>> turned out I was using the wrong handle in the first parameter. <groan>
>> It's working now! :-)
>
> Me 1
> Karl 49531

LOL! Oh man, I don't need *that* sorta pressure. <g>

This was just a classic case of needing to post about something
embarrassing before actually being able to see it myself. Ain't it the
way?

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Kevin Provance on

"Karl E. Peterson" <karl(a)exmvps.org> wrote in message
news:i0gar1$ooe$1(a)news.eternal-september.org...
: Brain freeze here, I guess.
:
: I need a simple one-shot timer (non form-based). I was thinking, just
: use SetTimer, then call KillTimer in the callback. But, KillTimer
: fails in the callback. LastDllError=0.
:
: What quick/easy way am I forgetting for a one-shot deal like this?
: (Betting I need to go with mmTimers, but I've been staring at the
: screen for too long, and need to stretch...)

Zoinks...so many replies. Maybe this has been brought up, but here is what
I did:

Public Function TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal
idEvent As Long, ByVal dwTime As Long) As Long
Select Case uMsg
Case WM_TIMER
Select Case idEvent
Case APP_TIMER_EVENT_ID
If tmrRunning = True Then
Call TimerStop(hwnd)
'other code here
End If 'tmrRunning
End Select
Case Else

End Select
End Function

Public Sub TimerStop(ByVal hwnd As Long)
If tmrRunning = True Then
Debug.Print "timer stopped"
Call KillTimer(hwnd, APP_TIMER_EVENT_ID)
tmrRunning = False
End If
End Sub

Yeah, tmrRunning is a module level boolean.


--
Customer Hatred Knows No Bounds at MSFT
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Bawwk! Paulie want a dingleball, bawwk!

From: Bob Butler on

"Karl E. Peterson" <karl(a)exmvps.org> wrote in message
news:i0gfmh$6au$1(a)news.eternal-september.org...
> Bob Butler has brought this to us :
> This was just a classic case of needing to post about something
> embarrassing before actually being able to see it myself. Ain't it the
> way?

I've long lost track of the number of times I figured out the problem trying
to explain it to somebody else or right after posting it


From: Karl E. Peterson on
Kevin Provance brought next idea :
> "Karl E. Peterson" <karl(a)exmvps.org> wrote in message
> news:i0gar1$ooe$1(a)news.eternal-september.org...
>> Brain freeze here, I guess.
>>
>> I need a simple one-shot timer (non form-based). I was thinking, just
>> use SetTimer, then call KillTimer in the callback. But, KillTimer
>> fails in the callback. LastDllError=0.
>>
>> What quick/easy way am I forgetting for a one-shot deal like this?
>> (Betting I need to go with mmTimers, but I've been staring at the
>> screen for too long, and need to stretch...)
>
> Zoinks...so many replies. Maybe this has been brought up, but here is what
> I did:

:-)

Yeah, it was just a dumb bonehead move on my part. I did get it going,
and am going to post a link momentarily.

Thanks...

--
..NET: It's About Trust!
http://vfred.mvps.org


From: MM on
On Wed, 30 Jun 2010 13:52:47 -0700, Karl E. Peterson <karl(a)exmvps.org>
wrote:

>Brain freeze here, I guess.
>
>I need a simple one-shot timer (non form-based). I was thinking, just
>use SetTimer, then call KillTimer in the callback. But, KillTimer
>fails in the callback. LastDllError=0.
>
>What quick/easy way am I forgetting for a one-shot deal like this?
>(Betting I need to go with mmTimers, but I've been staring at the
>screen for too long, and need to stretch...)
>
>Thanks... Karl

Why not use CCRP High Performance Timer Objects? Written by a pretty
bright kid I'm told... ;)

Works for me!

MM