Hallo,
Ich möchte gern Pfade von Fotos aus einem bestimmten Ordner in eine Listbox laden allerdings sind es immer unterschiedlich viele Fotos...
ich hatte bisher sowas hier aber das will nicht so wirklich.
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: 71: 72: 73: 74: 75: 76: 77:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, shellAPI, filectrl;
type TForm1 = class(TForm) ListBox1: TListBox; ListBox2: TListBox; OpenDialog1: TOpenDialog; Label1: TLabel; Label2: TLabel; procedure FormCreate(Sender: TObject); private public end;
var Form1: TForm1;
implementation
{$R *.dfm}
function FileCount(fileSpec: string): Integer; begin with TFileListBox.CreateParented(HWND(-3)) do try Mask := ExtractFileName(fileSpec); Directory := ExtractFilePath(fileSpec); FileType := [ftArchive]; Result := Items.Count; finally Free; end; end;
procedure TForm1.FormCreate(Sender: TObject); var place:Char; Errormode:word; i: Integer; zahl:string; begin place:='0';
ErrorMode := SetErrorMode(SEM_FailCriticalErrors); if directoryexists('G:\DCIM') then place:='G'; if directoryexists('H:\DCIM') then place:='H'; if directoryexists('I:\DCIM') then place:='I'; if directoryexists('J:\DCIM') then place:='J'; if directoryexists('K:\DCIM') then place:='K'; SetErrorMode(ErrorMode); label2.caption:=place; if place='0' then Showmessage('Kammera nicht Gefunden!') else Begin label1.caption:=inttostr(Filecount(place+':\DCIM\100DICAM')); for i := 0 to Filecount(place+':\DCIM\100DICAM\')-1 do Begin if i<1000 then zahl:='0'+inttostr(i); if i<100 then zahl:='00'+inttostr(i); if i<10 then zahl:='000'+inttostr(i); Listbox1.Items.Add(place+':\DCIM\100DICAM'+zahl); End;
End;
end;
end. |
Ziel sollte es sein Von einer bestimmten Kamera den Laufwerksbuchstaben zu ermitteln und dann alle vorhandenen Bilder automatisch anzuzeigen bzw. erstmal die dateinamen der bilder...
gibt bestimmt bessere lösungen als meine
schonmal danke im voraus für antworten
