I've been clinging on to VB6 for way too long and decided to move on to VB.NET 2008. I know practically nothing about .NET, but I do know that it has lots of new fangled memory protecty goodness. Unfortunately this seems to be preventing me from using QueryPerformanceFrequency and I have no idea how to get around it short of reading lots of 'Intro to .NET' articles (which I don't have time for at the minute).
I get the following error when calling QueryPerformanceFrequency:
ption was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I've created an empty project and put in the basic code to execute QueryPerformanceFreqency on a form; could someone please fix the code and briefly explain what had to be done (and why) to get it working.
Public Class Form1
Public Declare Function QueryPerformanceFrequency Lib "kernel32.dll" Alias "QueryPerformanceFrequency" (ByVal lpFrequency As Int64) As Long
Public Declare Function QueryPerformanceCounter Lib "kernel32.dll" Alias "QueryPerformanceCounter" (ByVal lpPerformanceCount As Int64) As Long
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frequency As Int64