Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2002.04.22;
Скачать: [xml.tar.bz2];

Вниз

Время создания файла.   Найти похожие ветки 

 
Wladimir   (2002-02-15 22:38) [0]

Пож. помогите извлеч дату создания файла. Именно - создания, а не последнего изменения. Спасибо.


 
Фэ   (2002-02-16 01:22) [1]

Ведь просто не хотелось по справке искать, так ?

TSearchRec = record
Time: Integer; //Time contains the time stamp of the file.
Size: Integer; //Size contains the size of the file in bytes.
Attr: Integer; //Attr represents the file attributes of the file.
Name: TFileName; //Name contains the DOS filename and extension.
ExcludeAttr: Integer;
FindHandle: THandle;
FindData: TWin32FindData; //FindData contains additional information such as
//file creation time, last access time, long and short filenames.

end;

//*****************
TWin32FindData = packed record
dwFileAttributes: Integer;
ftCreationTime: Int64;
ftLastAccessTime: Int64;
ftLastWriteTime: Int64;
nFileSizeHigh: Integer;
nFileSizeLow: Integer;
dwReserved0: Integer;
dwReserved1: Integer;
cFileName: array[0..259] of Char;
cAlternateFileName: array[0..13] of Char;
end;

//*****************
function FindFirstFile(FileName: PChar; var FindFileData: TWIN32FindData): Integer; stdcall;
external kernel name "FindFirstFileA";

//**********************
А вот это из sysutils - переделай под себя

function FileAge(const FileName: string): Integer;
var
Handle: THandle;
FindData: TWin32FindData;
LocalFileTime: TFileTime;
begin
Handle := FindFirstFile(PChar(FileName), FindData);
if Handle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
begin
FileTimeToLocalFileTime( FindData.ftLastWriteTime, LocalFileTime);
if FileTimeToDosDateTime(LocalFileTime, LongRec(Result).Hi,
LongRec(Result).Lo) then Exit;
end;
end;
Result := -1;
end;


 
Wladimir   (2002-02-16 18:38) [2]

Фэ, спасибо за помощь. Клянусь, по справке искал, просто по невнимательности пытался с _FILETIME работать как с 32bit
типом данных.


 
Wladimir   (2002-02-17 01:07) [3]

Фэ, я воспользовался вашей помощью и понял, что я совсем не "догада", а ведь всё оказалось очень просто.
Премного благодарен.



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2002.04.22;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.006 c
7-70052
НЕО
2002-01-26 10:58
2002.04.22
LOGIN пользователя, работающего на машине в сети...


14-70025
drpass
2002-03-18 13:48
2002.04.22
Windows 3.11 + TCP/IP


1-69795
User_OKA
2002-04-10 14:48
2002.04.22
Help!!! Защита!!!


14-69989
Builder
2002-03-15 08:13
2002.04.22
Круговой обзор


14-69978
ATLANTIDO
2002-03-10 20:06
2002.04.22
WinXP - Ctrl+Alt+Del ?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский