1.创建两个函数
void XXX::Continue()//继续
{
m_bStopFlag = false;
}
void XXX::Stop()//暂停
{
m_bStopFlag = true;
}
2.Button消息响应函数中
g_IsContinue = -1*g_IsContinue ;
if(g_IsContinue ==1)
{
GetDlgItem(ID)->SetWindowText(“暂停”);
Continue();
}
else
{
GetDlgItem(ID)->SetWindowText(“继续”);
Stop();
}
3.在while循环中
while(1)
{
if(m_bStopFlag = = true)
{
continue;
}
}
4.switch case调用时
m_bStopFlag = true;
g_IsContinue = -1;
GetDlgItem(ID)->SetWindowText(“继续”);
break;