1
VB and the development of wizards / QueryPerformanceCounter in currency type mismatch
« on: January 25, 2012, 03:55:20 AM »
Hello,
After searching on the web for implementing the QueryPerformanceCounter, the workaround is using currency type. However, I have a type mismatch issue.
Can you please advice how to make it work?
After searching on the web for implementing the QueryPerformanceCounter, the workaround is using currency type. However, I have a type mismatch issue.
Can you please advice how to make it work?
Quote
Option Explicit
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
Private Sub Form_Load()
Dim cTimer As Currency
Dim cTimer2 As Currency
Dim Freq As Currency
Dim i As Long
Dim temp As Double
QueryPerformanceFrequency Freq 'get frequency
QueryPerformanceCounter cTimer 'get first time
'do your stuff here stuff
For i = 1 To 2000000
temp = Sqr(i / 20 * (50 Mod i) ^ 3.333)
Next
QueryPerformanceCounter cTimer2 'get second time
Print Round((cTimer2 - cTimer) / Freq, 5) & "s" 'subtract first from second. then divide by freq.
End Sub