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

Вниз

Чтение названий файлов в написанных НЕрусскими и НЕанглийскими   Найти похожие ветки 

 
igorium ©   (2012-05-10 10:42) [0]

Удалено модератором
Примечание: спам


 
Плохиш ©   (2012-05-10 10:55) [1]


{$WARN SYMBOL_PLATFORM OFF}
unit SysUtilsW;

interface

uses
   Windows;
   
type
 TSearchRecW = record
   Time: Integer;
   Size: Integer;
   Attr: Integer;
   Name: WideString;
   ExcludeAttr: Integer;
   FindHandle: THandle  platform;
   FindData: TWin32FindDataW  platform;
 end;

 //  From SysUtils
 LongRec = packed record
   case Integer of
     0: (Lo, Hi: Word);
     1: (Words: array [0..1] of Word);
     2: (Bytes: array [0..3] of Byte);
 end;

const
{ File attribute constants }

 faReadOnly  = $00000001 platform;
 faHidden    = $00000002 platform;
 faSysFile   = $00000004 platform;
 faVolumeID  = $00000008 platform;
 faDirectory = $00000010;
 faArchive   = $00000020 platform;
 faSymLink   = $00000040 platform;
 faAnyFile   = $0000003F;

procedure FindCloseW(var F: TSearchRecW);
function FindFirstW(const Path: WideString; Attr: Integer; var  F: TSearchRecW): Integer;
function FindNextW(var F: TSearchRecW): Integer;
function WideCharToChar(const WCh: WideChar): String;
function WideStringToTranslit(const WString: WideString): String;

implementation

function FindMatchingFileW(var F: TSearchRecW): Integer;
var
 LocalFileTime: TFileTime;
begin
 with F do
 begin
   while FindData.dwFileAttributes and ExcludeAttr <> 0 do
     if not FindNextFileW(FindHandle, FindData) then
     begin
       Result := GetLastError;
       Exit;
     end;
   FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
   FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo);
   Size := FindData.nFileSizeLow;
   Attr := FindData.dwFileAttributes;
   Name :=  FindData.cFileName;
 end;
 Result := 0;
end;

procedure FindCloseW(var F: TSearchRecW);
begin
 if F.FindHandle <> INVALID_HANDLE_VALUE then
 begin
   Windows.FindClose(F.FindHandle);
   F.FindHandle := INVALID_HANDLE_VALUE;
 end;
end;

function FindFirstW(const Path: WideString; Attr: Integer;
 var  F: TSearchRecW): Integer;
const
 faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
 F.ExcludeAttr := not Attr and faSpecial;
 F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData);
 if F.FindHandle <> INVALID_HANDLE_VALUE then
 begin
   Result := FindMatchingFileW(F);
   if Result <> 0 then FindCloseW(F);
 end else
   Result := GetLastError;
end;

function FindNextW(var F: TSearchRecW): Integer;
begin
 if FindNextFileW(F.FindHandle, F.FindData) then
   Result := FindMatchingFileW(F) else
   Result := GetLastError;
end;

end.


 
igorium ©   (2012-05-11 09:03) [2]

Спасибо



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

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

Наверх





Память: 0.45 MB
Время: 0.071 c
15-1348077854
dm_member
2012-09-19 22:04
2013.03.22
Выделение памяти под запись с динамическим массивом


2-1341931500
Сергей
2012-07-10 18:45
2013.03.22
Как узнать что окно на заднем плане?


15-1340089952
Омлет
2012-06-19 11:12
2013.03.22
Почему FreeAndNil такой, какой он есть?


2-1341990007
sas9568635
2012-07-11 11:00
2013.03.22
Получение кода нажатых клавиш формы запущенной как Form.Show


15-1329815103
Kolan
2012-02-21 13:05
2013.03.22
Напомните историю про уволенного программиста





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский