Проверяем находится ли файл на локальном диске

function IsOnLocalDrive(aFileName: string): Boolean;
var
 aDrive: string;
begin
 aDrive := ExtractFileDrive(aFileName);
 if (GetDriveType(PChar(aDrive)) = DRIVE_REMOVABLE) or
  (GetDriveType(PChar(aDrive)) = DRIVE_FIXED) then
  Result := True
 else
  Result := False;
end;

// Example, Beispiel:
procedure TForm1.Button1Click(Sender: TObject);
begin
 if OpenDialog1.Execute then
  if IsOnLocalDrive(OpenDialog1.FileName) then
  ShowMessage(OpenDialog1.FileName + ' is on a local drive.');
end;

Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php

Отправить комментарий

Проверка
Антиспам проверка
Image CAPTCHA
...