Animate Event Example for C++ 4.0 and later

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

void CTutorDlg::OnAnimateLead1(BOOL bEnable) 
{
   CWnd *pButton = GetDlgItem(IDC_BUTTON1);
   if (bEnable == TRUE)
      pButton->SetWindowText("Stop Animation");
   else
      pButton->SetWindowText("Start Animation");
}

void CTutorDlg::OnButton1() 
{
   if (m_Lead1.GetAnimationEnable())
      m_Lead1.SetAnimationEnable(FALSE);
   else
      m_Lead1.SetAnimationEnable(TRUE);
}