延迟问题精确到ms
Private Declare Function timeGetTime Lib "winmm.dll" () As Long Public Sub WAITmS(ByVal WaitTime As Integer) Dim STARTmS As Double Dim NOWmS As Double STARTmS = timeGetTime If STARTmS < 0 Then STARTmS = STARTmS + 4294967296.0# End If Do Application.DoEvents() NOWmS = timeGetTime If NOWmS < 0 Then NOWmS = NOWmS + 4294967296.0# End If If STARTmS > NOWmS Then NOWmS = NOWmS + 4294967296.0# End If Loop While STARTmS + WaitTime > NOWmS ' GetTickCount End Sub
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long ' DelayNum为延时的毫秒数 Private Sub DelayTime(ByVal DelayNum As Long) Dim Ctr1, Ctr2, Freq As Currency Dim Count As Double If QueryPerformanceFrequency(Freq) Then QueryPerformanceCounter Ctr1 Do QueryPerformanceCounter Ctr2 Loop While (Ctr2 - Ctr1) / Freq * 1000 < DelayNum Else MsgBox "不支持高精度计数器!" End If End Sub
[解决办法]
纠正一点...Windows系统的系统时钟精度是15毫秒左右...
[解决办法]
是的...是15毫秒左右...
更确切地说,对于Intel芯片的精度为15-16ms,对于MIPS芯片的精度为10ms左右...而对Win98或其它系统来说,这个值可能是10-58ms...
[解决办法]
Windows系统的系统时钟精度是15毫秒左右
[解决办法]
C# 的声明方法...我这儿没有VB环境,你自己改改试试看吧...
[DllImport("Kernel32.dll")]private static extern bool QueryPerformanceCounter(out long lpPerformanceCount);[DllImport("Kernel32.dll")]private static extern bool QueryPerformanceFrequency(out long lpFrequency);
[解决办法]
修改数据,需要传递地址...
[解决办法]
MARK
[解决办法]
类似:http://topic.csdn.net/u/20090306/11/8513527f-1a84-45d4-a550-59072bc0c9d5.html