Change function from 32 to 64 bit version RRS feed

  • Question

  • I have this block of code and I want to adapt it for using in 64 bit application. How should I modify it?
    Option Compare Database
    Option Explicit
    Declare Function GetTickCount& Lib "kernel32" ()
    Function jpDelay(ByVal plngMillisecs As Long) As Long
    ' Accepts   Milliseconds to delay for
    ' Returns   The actual number of milliseconds delayed for (will be >= plngMillisecs)
    ' Waits until at least pintMillisecs have elapsed and then exits
    ' Since DoEvents is going to take a reasonable amount of time, it is only used if the total time to delay for
    '   is > 10 milliseconds (otherwise the DoEvents delay is likely to make the delay much bigger than requested)
      Dim lngStartTime As Long
      Dim lngTimeToReturn As Long
      Dim lngCurrentTime As Long
        lngStartTime = GetTickCount()
        lngCurrentTime = lngStartTime
        lngTimeToReturn = lngStartTime + plngMillisecs
        Do While lngTimeToReturn > lngCurrentTime
          If plngMillisecs > 10 Then DoEvents
          lngCurrentTime = GetTickCount()
        jpDelay = (lngCurrentTime - lngStartTime)
    End Function


    Friday, September 25, 2015 2:47 PM