L
lee_xl
Unregistered / Unconfirmed
GUEST, unregistred user!
例如:<br>var<br> Security: TSecurityAttributes; <br> hFile: Integer; <br> FileInfo: TByHandleFileInformation; <br> Intermediate: TFileTime; <br> SystemTime: TSystemTime; <br><br> FileType: DWORD; <br> <br>begin<br> Security.nLength:=SizeOf(TSecurityAttributes);<br> Security.bInheritHandle:=FALSE;<br> hFile:=CreateFile(PChar(FileListBox1.FileName), GENERIC_READ, 0, @Security,<br> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);<br> if (hFile <> INVALID_HANDLE_VALUE) then<br> begin<br> GetFileInformationByHandle(hFile,FileInfo);<br> Label1.Caption := ExtractFileName('SQLServer200DataBase.mdf');<br> FileTimeToLocalFileTime(FileInfo.ftLastWriteTime, Intermediate);<br> FileTimeToSystemTime(Intermediate, SystemTime);<br> <br> {display the volume serial number}<br> Label8.Caption:=IntToStr(FileInfo.dwVolumeSerialNumber);<br> {display the file size}<br> Label4.Caption:=IntToStr(GetFileSize(hFile, nil))+ ' bytes';<br> FileType:=GetFileType(hFile);<br> <br> CloseHandle(hFile);<br> end;<br>但是windows判断不出文件类型,得出的文件大小为0!!!<br>请大家赐教!<br>