Autor Beitrag
Robii
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Fr 12.06.09 22:31 
Seid gegrüßt, ( mal eine etwas originellere Begrüßung)
ich möchte, das in meinem Programm ein Tree der Festplatte gemacht wird, wie wenn man in die CMD 'Tree' eingibt. Dieses Bild(/TextDatei/Stringliste/Was auch immer), soll dann in einer Textdatei gespeichert werden. Leider habe ich überhaupt
keine Ahnung wie ich das anstellen soll, vermute nur, das ich das mit 'TTreeView' machen muss, oder? Würde mich über Hilfe freuden.
Gruß
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Fr 12.06.09 22:37 
zum beispiel mit
ausblenden Delphi-Quelltext
1:
shellexecute (nilnil'tree C: >C:tree.txt'nilnil);					

oder so änlich.
(Hab grad kein delphi da
mfg Boldar
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 12.06.09 22:40 
Und was hat das mit Abbild zu tun? Abbild wäre für mich eher sowas wie Acronis True Image, also eine Sicherung des Computers.

Zu deinem Problem:
Man kann in der Konsole die Ausgabe auch in Dateien umleiten..

tree > tree.txt

_________________
PROGRAMMER: A device for converting coffee into software.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Fr 12.06.09 22:50 
Muss ich sonst noch irgendetwas ändern, den so kennt mein Delphi diesen Befehl leider nicht.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Wie das in der Konsole funktioniert, weiß ich ja. Aber es geht mir ja darum, das es in meinem Delphi-Programm funktioniert.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 12.06.09 22:59 
Du musst noch eine Unit einbinden. Glaub ShellAPI heißt die.

_________________
PROGRAMMER: A device for converting coffee into software.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Fr 12.06.09 23:11 
Richtig, das habe ich jetzt getan, aber jetzt kommt folgende Fehlermeldung
Zitat:
[Pascal Fehler] Upload_Unit.pas(42): E2010 Inkompatible Typen: 'HWND' und 'Pointer'

bei folgendem Code:
ausblenden Delphi-Quelltext
1:
  shellexecute (nilnil'tree C: >C:tree.txt'nilnil);					


Was heißt das, sorry ich verstehe den Code nicht wirklich, also was das nil heißt..
Gruß
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Fr 12.06.09 23:33 
ausblenden Delphi-Quelltext
1:
shellexecute (handle, nil'tree C: >C:tree.txt'nilnil);					

müsste gehen.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Fr 12.06.09 23:40 
ausblenden Delphi-Quelltext
1:
 Shellexecute (handle, nil'tree C:\Fiaa\ >C:tree.txt'nilnil,SW_SHOWNORMAL);					


Genau so habe ich es geschrieben, scheint aber nicht zu klappen. Habe das mal mit der Konsole versucht,
da wird immer de Fehlermeldung 'Zugriff verweigert' gemeldet. Wie kann ich das ändern? Grüße.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 12.06.09 23:48 
a) gibt es das von dir angegebene Verzeichnis c:\fiaaa\ ?
b) Füg mal im Dateinamen, wo er das abspeichern soll, einen \ ein.

_________________
PROGRAMMER: A device for converting coffee into software.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Fr 12.06.09 23:54 
Ja das Verzeichniss gibt es definitv. Auch mti dem / klappt es nicht.
Kann es an dem Zugriff verweigert liegen ? Grüße.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19345
Erhaltene Danke: 1753

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.06.09 00:16 
Naja, unter c: direkt wirst du ja auch keine Schreibrechte haben...
Ich würde schauen wo das Tempverzeichnis ist und dieses benutzen oder direkt vorher den Speicherndialog anzeigen.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Sa 13.06.09 00:26 
Auch im Ordner 'Eigene Dateien ' wird keine Txt File erstellt.
Ich probier es noch mal mit der Konsole im gleichen Verzeichnis.
Gruß

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Seltsamer Weise klappt es wenn ich in der Konsole folgendes eingebe:
Zitat:

Tree >Test.txt


Wieso klappt es so, aber nicht, wenn ich die TXT-Datei in ein anderes Verzecihniss verschieben will?
Gruß
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19345
Erhaltene Danke: 1753

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.06.09 01:05 
So klappt es dann:
ausblenden Delphi-Quelltext
1:
Shellexecute(Handle, 'open''cmd.exe''/C tree  C:\Fiaa > C:\...\tree.txt'nil, SW_SHOWNORMAL);					
Erklärung: Das Piping via > funktioniert nur in der Konsole, so wie vorher wäre es ein Parameter an Tree. ;-)