Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timers are driving me nuts...

Status
Not open for further replies.

TheRealBart

Technical User
May 17, 2006
1
0
0
US
Okay... first I'll come clean. I'm making a bot for the Active Worlds 3d chat environment. It requires that WM_TIMER be set up on the MFC form. No problem (after about a week of struggling...). So I finally got that working.

Now I find a need to use more timers. When I set the timer in the DlgInit area, a command like this works fine:

int Timer1 = 1;

SetTimer(Timer1, 100, NULL);

To catch the timer, I do this:

void CThingyDlg::OnTimer(UINT nIDEvent)
{
if(nIDEvent == TIMER1){
aw_wait(0);
}
CDialog::OnTimer(nIDEvent);
}

But when I try to set a timer outside of the DlgInit area, it wants 4 parameters and just basically doesn't want to do what I want even when I do get the errors to stop.

I need to get these timers working, but I can't understand all the stuff that I've googled and typos blow me off course for hours.

What I'm really looking for are multiple one shot timers. They don't have to be varying times - just so long as I can shut them off in sequence. They also need to be associated with an array - something like:

int tim[300][3] = {0}; //info array
int t = 2; //second timer starting point

void CThingyDlg::OnTimer(UINT nIDEvent)
{
if(nIDEvent == TIMER1){
aw_wait(0);
}

if(nIDEVent != Timer1){
tim[t][1] = anyintvariable;
tim[t][2] = anotherintvar;
tim[t][3] = yetanotherint;
KillTimer(t);
t++;
}
CDialog::OnTimer(nIDEvent);
}

But that doesn't want to work... Maybe I'm not using the AW SDK properly...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top