VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

General Fast,multipurpose,Event driven Class to Find Files using API FindFirstFile,FindNextFile.

Ulhas Aswar  (4 Submissions)   Windows API Call/Explanation   VB 6.0   Unknown Difficulty   Mon 3rd November 2003   Mon 8th February 2021

General Fast,multipurpose,Event driven Class to Find Files using API FindFirstFile,FindNextFile.

API Declarations


Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As Any, lpLocalFileTime As Any) As Long

Const rDayZeroBias As Double = 109205# ' Abs(CDbl(#01-01-1601#))
Const rMillisecondPerDay As Double = 10000000# * 60# * 60# * 24# / 10000#
Const MAX_PATH = 260

Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As Currency
ftLastAccessTime As Currency
ftLastWriteTime As Currency
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
cPath As String * MAX_PATH
End Type

Function Win32ToVbTime(ft As Currency) As Date
Dim ftl As Currency
' Call API to convert from UTC time to local time
If FileTimeToLocalFileTime(ft, ftl) Then
' Local time is nanoseconds since 01-01-1601
' In Currency that comes out as milliseconds
' Divide by milliseconds per day to get days since 1601
' Subtract days from 1601 to 1899 to get VB Date equivalent
Win32ToVbTime = CDate((ftl / rMillisecondPerDay) - rDayZeroBias)
Else
MsgBox Err.LastDllError
End If
End Function


Rate General Fast,multipurpose,Event driven Class to Find Files using API FindFirstFile,FindNextFile. (1(1 Vote))
General Fast,multipurpose,Event driven Class to Find Files using API FindFirstFile,FindNextFile..bas

General Fast,multipurpose,Event driven Class to Find Files using API FindFirstFile,FindNextFile. Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters