DelyDlg.rar

  • 枭雄曹操
    了解作者
  • C/C++
    开发工具
  • 534B
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2022-01-21 11:26
    上传日期
QueryPerformanceFrequency高精度定时器应用
DelyDlg.rar
  • DelyDlg.cpp
    810B
内容介绍
void CDelyDlg::InitialTime(void) { LARGE_INTEGER litmp; double dfFreq; if (QueryPerformanceFrequency(&litmp) == 0) { AfxMessageBox(_T("主频太低")); m_dNewFrequency = 1.2; } dfFreq = (double)litmp.QuadPart; m_dNewFrequency = dfFreq / 1000000; } void CDelyDlg::MselDelay(long time) { if (time < 0) return; LARGE_INTEGER litmp; double count = ((double)time)*m_dNewFrequency; LONGLONG QPart1, QPart2; QueryPerformanceCounter(&litmp); QPart1 = litmp.QuadPart; QPart2 = QPart1; while ((double)(QPart2 - QPart1) < count) { //消息分发机制 MSG msg; if (PeekMessage(&msg, (HWND)NULL, 0, 0, PM_REMOVE)) { ::SendMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam); } // QueryPerformanceCounter(&litmp); QPart2 = litmp.QuadPart; } }
评论
    相关推荐