Elikkä kyseessä on laitteistoajastin, josta Antti Laaksonen teki jo koodivinkin, josta itse väänsin teille toimivan luokan, jota on erittäin helppo käyttää, ja toimii osapuilleen samalla tavalla kuin GetTickCount()
Luokka tarjoaa käyttöön kaksi metodia, Available ja CurrentTime. Available kertoo toimiiko ajastin, ja CurrentTime palauttaa sen oleellisen tiedon - ajan.
Option Explicit Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As LARGE_INTEGER) As Long Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As LARGE_INTEGER) As Long Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Type LARGE_INTEGER LowPart As Long HighPart As Long End Type Private qpFrequency As LARGE_INTEGER Private qpAvailable As Boolean Private qpCurrentTime As LARGE_INTEGER Private Sub Class_Initialize() If QueryPerformanceFrequency(qpFrequency) = 0 Then qpAvailable = False Else qpAvailable = True End If End Sub Private Function LargeIntToCurrency(liInput As LARGE_INTEGER) As Currency CopyMemory LargeIntToCurrency, liInput, LenB(liInput) LargeIntToCurrency = LargeIntToCurrency * 10000 End Function Public Property Get Available() As Boolean Available = qpAvailable End Property Public Property Get CurrentTime() As Currency QueryPerformanceCounter qpCurrentTime CurrentTime = LargeIntToCurrency(qpCurrentTime) / LargeIntToCurrency(qpFrequency) End Property
Aihe on jo aika vanha, joten et voi enää vastata siihen.