如何将 FILETIME 从 WinApi 转换(例如,从调用此 WINAPI 函数的结果到 vb6 中的 DateTime?(例如,如果我想将其用作DateTime.DateDiff函数的输入。)
问问题
2646 次
1 回答
4
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Public Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function SystemTimeToVariantTime Lib "OLEAUT32.DLL" (lpSystemTime As SYSTEMTIME, vtime As Date) As Long
Dim st As SYSTEMTIME
Dim dt As Date
' convert a FILETIME to SYSTEMTIME first
FileTimeToSystemTime ft, st
' convert the SYSTEMTIME to a Variant date (VT_DATE)
SystemTimeToVariantTime st, dt
于 2013-02-08T07:30:14.737 回答