65,186
社区成员




float Speed=0.0;
// 进度条步长
UINT ProcessLength;
//进度说明
CString Notice;
UINT Perscent=0;
float statu=0.0;
ProcessLength=29760182;
DWORD Strat=0,End=0;
Strat=GetTickCount();//DWORD
//读文件
Readed=file->Read(ByteReceive,sizeof(ByteReceive));//ByteReceive设置为8888
End=GetTickCount();//DWORD
Speed=(float)Readed*1000/(End-Strat);//1000毫秒;
Perscent=Perscent+Readed;//UINT
float LeftTime=0;
LeftTime=(ProcessLength-Perscent)/Speed;//在这里Speed的值有时出现,1.#INF,不像溢出,除数为零
Notice.Format(_T("剩余时间:%6.2f s"),LeftTime);
DownNoticeInfo.LeftTime->SetWindowTextW(Notice);
if(Speed>=1024&&Speed<1024*1024)
Notice.Format(_T("即时速度:%6.2fKB/s"),Speed/1024);
else
if(Speed>=1024*1024)
Notice.Format(_T("即时速度:%6.2fMB/s"),Speed/1024/1024);//这里输出怎么会出现1.#JMB?
else
Notice.Format(_T("即时速度:%6.2fB/s"),Speed);
DownNoticeInfo.DownSpeed->SetWindowTextW(Notice);