在VC中进行计时操作(可精确到毫秒)

来源:互联网 发布:校园二手交易 php源码 编辑:程序博客网 时间:2024/05/16 07:02
DWORD t0, tt; // DWORD = unsigned long

//计时开始
t0 = GetTickCount(); // 返回“毫秒”

//处理过程
//...............
//...............

//计时结束
tt = GetTickCount();

CString msg;
msg.Format(
"用时 %.3f 秒", (t1-t0)/1000.0);
AfxMessageBox(msg);