i have this class
and i get exceptions here QueryPerformanceFrequency(m_Frequency) and here QueryPerformanceCounter(m_Count):
An unhandled exception of type System.InvalidProgramException occurred in xfengine.dll
Additional information: Error: PInvoke item (field,method) must be Static.
The program [1588] XF2.exe has exited with code 0 (0x0).
xfengine.dll is my class library containing the high resolution timer and XF2.exe is the console app using xfengine.dll
any help much appreciated
Stephen
Code:
Imports System.Runtime.InteropServices
Public Class Timer
Private m_Frequency As Long
Private m_Count As Long
Public Sub New()
QueryPerformanceFrequency(m_Frequency)
End Sub
Public ReadOnly Property FTime() As Double
Get
QueryPerformanceCounter(m_Count)
Return m_Count / m_Frequency
End Get
End Property
<DllImport("Kernel32.dll")> Private Function QueryPerformanceCounter(ByRef lpPerformanceCount As Long) As Boolean
End Function
<DllImport("Kernel32.dll")> Private Function QueryPerformanceFrequency(ByRef lpFrequency As Long) As Boolean
End Function
End Class
and i get exceptions here QueryPerformanceFrequency(m_Frequency) and here QueryPerformanceCounter(m_Count):
An unhandled exception of type System.InvalidProgramException occurred in xfengine.dll
Additional information: Error: PInvoke item (field,method) must be Static.
The program [1588] XF2.exe has exited with code 0 (0x0).
xfengine.dll is my class library containing the high resolution timer and XF2.exe is the console app using xfengine.dll
any help much appreciated
Stephen