問題二: 看以下源碼:
Function isExists(adir : string;Ex:string):boolean;
var
sr: TSearchRec;
FileAttrs: Integer;
begin
Result := False ;
FileAttrs := faAnyFile;
if aDir[Length(adir)]<>'\' then
aDir := aDir + '\';
if SysUtils.FindFirst(aDir+Ex, FileAttrs, sr) = 0 then
begin
Result := True ;
SysUtils.FindClose(sr);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if isExists('f:\','*.JPg') then
caption := 'OK';
end;