AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Nach Batchencode Datei OHNE OpenDialog öffnen - Wie?
Thema durchsuchen
Ansicht
Themen-Optionen

Nach Batchencode Datei OHNE OpenDialog öffnen - Wie?

Ein Thema von DRPEnc · begonnen am 27. Feb 2004 · letzter Beitrag vom 28. Feb 2004
 
DRPEnc

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

Re: ShellExecuteEx wie ausführen

  Alt 28. Feb 2004, 01: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
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz