# Re: 如何得知档案资讯？

Posted by Booker Hsu on July 03, 1999 at 10:03:43:

In Reply to: 如何得知档案资讯？ posted by SuBird on June 11, 1999 at 14:37:30:

: 请教各位:
: 如何知道某档案的修改日期、属性(R,A,S,H)、大小等资讯?

在VB SETUPKIT 有一段程式码：
Declare Function GetFileVersionInfoSize Lib "VERSION.DLL" Alias "GetFileVersionInfoSizeA" (ByVal strFilename As String, lVerHandle As Long) As Long
Declare Function GetFileVersionInfo Lib "VERSION.DLL" Alias "GetFileVersionInfoA" (ByVal strFilename As String, ByVal lVerHandle As Long, ByVal lcbSize As Long, lpvData As Byte) As Long

'Get the size of the file version info, allocate ' a buffer for it, and get the
'version info. Next, we query the Fixed file
' info portion, where the internal
'file version used by the Windows VerInstallFile
' API is kept. We then copy
'the fixed file info into a VERINFO structure.
'
lVerSize = GetFileVersionInfoSize(strFilename,
lVerHandle)
If lVerSize > 0 Then
ReDim byteVerData(lVerSize)
If GetFileVersionInfo(strFilename, lVerHandle,
lVerSize, byteVerData(0)) <> 0 Then
' (Pass byteVerData array via reference to first
' element)
If VerQueryValue(byteVerData(0),
strFIXEDFILEINFO & "", lpBufPtr, lVerSize)
<> 0 Then
lmemcpy sVerInfo, lpBufPtr, lVerSize
fFoundVer = True
GetFileVerStruct = True
End If
End If
End If

自行参考 vb\setupkit\setup1\ 中专案档

Follow Ups: