PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: mwmeeks on April 27, 2004, 04:56:36 PM

Title: How to Creating a Timer for FF
Post by: mwmeeks on April 27, 2004, 04:56:36 PM
Hi,

Still not sure where I begin on this issue.

I saw the other post on the timer issue - but that didn't steer me in the right direction.

I need a timer to update a label on my form every 100ms.

Where do we add the SELECT CASE wMsg ? FF_PUMPHOOK?  Where?
Where do we create the timer?  L = SETTIMER( hWndForm, 1, %TIMERIntervall_Notify, BYVAL 0 )

I can do it in PB - but FF has me lost for this issue.

Thanks in advance!

Regards
Mike
Title: How to Creating a Timer for FF
Post by: Peter Jinks on April 27, 2004, 07:43:19 PM
Hi Mike,

If this timer is going to run all the time your form is around, I would suggest you create it in the form's WM_CREATE message;

Function FRMTIMER_WM_CREATE (hWndForm As Dword) As Long
' Create a timer to fire every second (1000 milliseconds)
SetTimer HWND_FRMTIMER, 1, 1000, ByVal %Null
End Function


And get rid of it during WM_DESTROY;

Function FRMTIMER_WM_DESTROY (hWndForm As Dword) As Long
' Remove our timer - send the handle of the window (form)
'  and the ID we gave the Timer when we Set it (1)
KillTimer HWND_FRMTIMER, 1
End Function


You can then handle the timer events in the form's CUSTOM message handler - something like this;


Function FRMTIMER_CUSTOM (hWndForm As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long
' Static used to keep count
Static lCount As Long

' Check to see if this is our timer
Select Case wMsg
Case %WM_TIMER
' Increment our counter
Incr lCount
' Show the new count on the form
SetWindowText HWND_FRMTIMER_LBLTIMER, Str$(lCount)
End Select
End Function


In this example, the timer is just used to update a label (lblTimer) on the form (frmTimer) about every second or so, with a simple counter, but obviously you can have it do whatever you want.

Hope that helps.

Regards,

Pete.
Title: How to Creating a Timer for FF
Post by: mwmeeks on April 27, 2004, 10:40:23 PM
Thanks Peter,

Appreciate your help!

Mike