主题:一个经典的问题 : Sleep()
用Sleep()函数时,是不是程序不能进入消息循环了,也就是说窗口不能更新了?我有如下代码:
OnBnClickedButtonRun()
{
IfLoaded=DriverLoad();
if (IfLoaded==TRUE)
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Loaded"));
else
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Loaded NG"));
Sleep(1000);
IfLoaded=DriverUnload();
if (IfLoaded==TRUE)
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Unloaded"));
else
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Unloaded NG"));
}
可是在SLEEP过程中静态文本一直不能更新,一点按钮后就只显示最后的结果,我试过用Application->ProcessMessages(); 可是提示Application:undeclared identifier。哪位高手指一下,谢谢了。
OnBnClickedButtonRun()
{
IfLoaded=DriverLoad();
if (IfLoaded==TRUE)
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Loaded"));
else
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Loaded NG"));
Sleep(1000);
IfLoaded=DriverUnload();
if (IfLoaded==TRUE)
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Unloaded"));
else
SetDlgItemText(IDC_STATIC_RESULT,TEXT("Driver Unloaded NG"));
}
可是在SLEEP过程中静态文本一直不能更新,一点按钮后就只显示最后的结果,我试过用Application->ProcessMessages(); 可是提示Application:undeclared identifier。哪位高手指一下,谢谢了。