Click to See Complete Forum and Search --> : Help me with SetTimer function


Drago
May 1st, 1999, 10:29 AM
Hi,
I need your help. I just like use SetTimer but
I don't understand what must I include like 3th parameter in SetTimer. I'd like to set timer on in MDI application in Main Frame before opening any views
Thank you in advance!
Drago

Jason Brooks
May 1st, 1999, 04:59 PM
I tend to cheat and use SetTimer like this.

First define a UINT in your class to hold the timer value.

i.e.

class myclass : public CDialog
{
UINT m_nTimer;

....

}

Now somewhere in your code, InitDialog or what ever use:-

m_nTimer = SetTime(1,1000,NULL)

Add a WM_TIMER message using class wizard and poulate it with some code. i.e.

void myclass::OnTimer(UINT nIDEvent)
{
static char buff[80];

// Check to see if event was triggered by your timer.
// i.e. Can start several timers
if(nIDEvent==m_nTimer)
{
// Do your stuff
}
return TRUE;
}

I hope this helps.
Jason.
http://www.netcomuk.co.uk/~jbrooks

Masaaki
May 1st, 1999, 06:02 PM
Hi.

If you want to use your callback funtion, you can put the function name at the 3rd parameter.

HTH.
-Masaaki Onishi-