1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70:
| library Project1;
uses Windows, SysUtils, Classes;
function findfile(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall; var SearchRec: TSearchRec; s1,s2,s3,s4,s5: String; Strlst: TStringList; z1,z2,z3,tfiles,tsize,z4,y4,x4: Integer; begin z1 := 0; z2 := 0; z3 := 1; Strlst := TStringlist.Create; try Strlst.Delimiter := ' '; Strlst.DelimitedText := data; s1 := Strlst[0]; s2 := Strlst[1]; s3 := Strlst[2]; finally FreeAndNil(Strlst); end; FindFirst(s1 + s2, faAnyFile, SearchRec); if (SearchRec.Name = '') then else begin while (z3 = 1) do begin FindNext(SearchRec); if (SearchRec.Name = s4) then z3 := 0 else begin s4 := SearchRec.Name; z2 := z2 + SearchRec.Size; z1 := z1 + 1 end; end; end; tfiles := z1; tsize := z2; z3 := 1; if (tfiles < StrToInt(s3)) then z3 := 0; FindFirst(s1 + s2, faAnyFile, SearchRec); z1 := z1 + 1; if (StrToInt(s3) > z1) then begin while (z3 = 1) do begin FindNext(SearchRec); if (SearchRec.Name = s4) then begin z3 := 0; s4 := ''; end else begin s4 := SearchRec.Name; z4 := SearchRec.Size; y4 := SearchRec.Time; x4 := SearchRec.Attr; z1 := z1 + 1; end; end; s5 := s4 + '' + IntToStr(z4) + '' + IntToStr(y4) + '' + IntToStr(x4); StrCopy(data,PAnsiChar(s5)); Result := 3 end; end;
exports findfile;
{$R *.RES}
begin end. |