Einzelnen Beitrag anzeigen

DRPEnc

Registriert seit: 20. Feb 2004
Ort: Noch unterm Mond
126 Beiträge
 
#2

Re: ShellExecuteEx wie ausführen

  Alt 28. Feb 2004, 02:30
Das mit der filesize hab ich so gelöst:

Delphi-Quellcode:
function GET_FILE_SIZE(sFileToExamine:string;bInKBytes:boolean):string;
{for some reason both methods of finding file size return
a filesize that is slightly larger than what Windows File
Explorer reports}

var
FileHandle : THandle;
FileSize : LongWord;
d1 : double;
i1 : int64;
begin
//a- Get file size
FileHandle := CreateFile(
PCHAR(sFileToExamine),
GENERIC_READ,
0, {exclusive}
nil, {security}
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
FileSize := GetFileSize(FileHandle,nil);
result := INTTOSTR(FileSize);
CloseHandle(FileHandle);
//a- optionally report back in Kbytes
//if bInKbytes = true then
//begin
//if length(result)> 3 then
//begin
//Insert('.',result,length(result)-2);
//d1 := strtofloat(result);
//result := inttostr(round(d1))+'KB';
//end
//else
//result := '1KB';
end;
{********************************************
Hier eine andere funktionierende Methode:
*********************************************
var
SearchRec: TSearchRec;
sgPath : String;
inRetval, I1 : Integer;
begin
sgPath := ExpandFileName(sFileToExamine);
Try
inRetval := FindFirst(ExpandFileName(sFileToExamine), faAnyFile, SearchRec);
If inRetval = 0 Then
I1 := SearchRec.Size
Else I1 := -1;
Finally
SysUtils.FindClose(SearchRec);
End;
result := Inttostr(I1);
end; }

//end;
Und anzeigen mit:

Delphi-Quellcode:
procedure TForm12.Button8Click(Sender: TObject);
var a,b :real;

begin
If Not OpenDialog3.Execute Then Exit;
Edit8.Text:=GET_FILE_SIZE(Opendialog3.filename,true);
a:= StrToFloat(Edit8.text);
b:=(a / 1024) /1024;
listbox1.Items.add('This Pass has the filesize of ' +FloatToStr(b)+ ' MB');

end;
Nun muss ich das Ganze automatisieren...
CU

DRPEnc
  Mit Zitat antworten Zitat