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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetTimer() help

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
US
I'm trying to set up a timer using SetTimer(); but I'm not completely sure how it all works together. I understand that you set up a timer and when the time has expired, it calls a functions. I guess I'm just confused on all the technicality of it. I tried to look in MSDN, but couldn't really find anything to help me understand how to set up the the CALLBACK function and how it all works togeter. If someone could explain this to me or direct me to a good website I would be greatly apprecitive. Thanks in advance.

Niky Williams
NTS Marketing
 
The third parameter in SetTimer specifies the address of the application-supplied TimerProc callback function that processes the WM_TIMER messages. If this parameter is NULL, the WM_TIMER messages are placed in the application's message queue and handled by the CWnd object.
viz you can call SetTimer

SetTimer(1, 10000, NULL);

and handle messages in OnTimer function

CXxx::OnTimer(UINT nIDEvent)
{

switch(nIDEvent)
{
case 1:
AfxMessageBox("Hello");
break;


}

Not return value of SetTimer function can be passed to KillTimer function to kill specific Timer.

CDialog::OnTimer
}



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top