home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "VBPGUtils"
- Option Explicit
- ' Copyright ⌐ 1997 by Desaware Inc. All Rights Reserved
-
-
- '
- ' Returns the difference in milliseconds between two FILETIME structures
- ' Note that very large time differences will break this code - it's intended
- ' to facilitate performance comparisons only.
- '
- Public Function FileTimeDifference(f1 As FILETIME, f2 As FILETIME) As Long
- Dim low1&, low2&, carry&
- ' First shift the low values
- low1& = f1.dwLowDateTime \ 10000
- low2& = f2.dwLowDateTime \ 10000
-
- ' If high values are equal, no overflow issues
- If f1.dwHighDateTime = f2.dwHighDateTime Then
- FileTimeDifference = low1& - low2&
- Else
- ' If we had an overflow, Add the "carry"
- ' Each high field is 214748 milliseconds
- carry& = f1.dwHighDateTime - f2.dwHighDateTime
- FileTimeDifference = (low1& + 214748 * carry) - low2&
- End If
- End Function
-
- '
- ' Extracts a VB string from a buffer containing a null terminated
- ' string
- Public Function LPSTRToVBString$(ByVal s$)
- Dim nullpos&
- nullpos& = InStr(s$, Chr$(0))
- If nullpos > 0 Then
- LPSTRToVBString = Left$(s$, nullpos - 1)
- Else
- LPSTRToVBString = ""
- End If
- End Function
-