I have got the next problem. In windows forms I need to make a timer that simulates a while loop. I have runned some tests and a while loop is about 27 times faster than a timer with 1 interval. So my question is, how can I simulate a while loop with my timer. This is the code I used to test the interval:
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
m_nI++;
lbltimer->Text = m_nI++.ToString();
if (m_nI > 10000000)
{
timer1->Enabled = false;
}
while(1)
{
m_nIMin++;
lblLoop->Text = m_nIMin.ToString();
Application::DoEvents();
if (m_nIMin > 10000000)
{
break;
}
}
}
m_nI is declared global just as m_nIMin they are both ints. Any respond in c++/cli or c++ would be welcome. Thanks in advance.
PS. I know Application::DoEvents() isn't good to use but its the only solution on testing a infinite while loop in windowsforms.