Autor Beitrag
sklorzy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Sa 01.05.04 15:01 
Hi,
gibt es eine Möglichkeit den Inhalt eines Ordners, also z.B. die Namen von Textdokumenten, in eine Listbox einzulesen??

Ordnerinhalt: Textdokument1.txt

Lsitbox1:Textdokument1.txt

So sollte das ungefähr aussehen.

Danke schon mal im Voraus
mfg:Sklorzy
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 01.05.04 15:12 
hi,

such doch einfach mal in den FAQ's nach "FindFirst"!


raziel

_________________
JSXGraph
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Sa 01.05.04 15:21 
Hi,

Einfacher geht's noch wenn man ein LB_DIR an die Listbox sendet.

(Siehe z.B www.swissdelphicente...howcode.php?id=1495)
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Sa 01.05.04 19:26 
Titel: Ich hab bei deiner Lösung ein Problem Tom
Und zwar
hab ich den QT kopiert und für mich abgeändert, was den Pfad angeht. Jetzt hab ich nicht die Namen der Textdokumente in der Listbox, sondern eine Aufzählung von [a] bis ["Anzahl der Textdokumente"].
Was kann ich dagegen tun??
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 02.05.04 01:52 
Zitat:
Jetzt hab ich nicht die Namen der Textdokumente in der Listbox, sondern eine Aufzählung von [a] bis ["Anzahl der Textdokumente"].


Verstehe nicht ganz was du damit meinst?
Was genau gibt es in der Listbox aus? (Screenshot od Listbox Inhalt posten wäre hilfreich)
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 02.05.04 07:48 
Also er gibt in der Listbox folgendes aus:

[Test]
[-a-]
[-c-]
[-d-]
[-e-]


Ich hab auch fünf Textdokumente in dem Ordner, sodass ich meinte er zählt von a - Anzahl der Textdokumente.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button1Click(Sender: TObject);
var
  D: PChar;
begin
   D := 'C:\Programme\Borland\Delphi7\Projects\Test\Test';
   ListBox1.Perform(LB_DIR,
                    DDL_ARCHIVE +
                    DDL_DIRECTORY +
                    DDL_DRIVES +
                    DDL_EXCLUSIVE +
                    DDL_HIDDEN +
                    DDL_READONLY +
                    DDL_READWRITE +
                    DDL_SYSTEM,
                    Integer(d));
end;


Hab ich da irgendein Fehler im Quelltext??
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 02.05.04 07:52 
Du musst halt einige Konstanten noch rausnehmen wie DDL_DRIVES,
sonst listet er Dateien auf, welche du gar nicht möchtest.

Im weiteren musst du, wenn nur Textdokumente (*.txt) aufgelistet werden sollen, den
entsprechenden Filter (*.txt) setzen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  D: PChar;
begin
   D := 'C:\Programme\Borland\Delphi7\Projects\Test\Test\*.txt';
   ListBox1.Perform(LB_DIR,
                    DDL_ARCHIVE +
                    DDL_EXCLUSIVE +
                    DDL_HIDDEN +
                    DDL_READONLY +
                    DDL_READWRITE,
                    Integer(D))
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 02.05.04 11:41 
Titel: Danke
Danke für deine Hilfe Tom
Anfänger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

WinXP
D3 Prof
BeitragVerfasst: Mi 05.05.04 21:50 
Funzt das auch irgendwie bei der Combobox?

Ich wollte einfach Listbox durch Combobox austauschen, aber es passiert nichts.

Woran liegt das und wie passe ich den Code an?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 06.05.04 09:37 
Die Combobox kennt den Stil LB_DIR eben nicht.