Autor Beitrag
whitef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 03.02.07 13:52 
Hi,
ich wollte mal an dieser Stelle fragen ob es möglich ist mittels OpenDialog
direkt in ein vorgegebenen Ordner-Pfad zu gelangen.
Normalerweise öffnet sich ja Arbeitplatz oder der letzt besuchte Ordner, allerdings möchte ich z.B.
sofort den Ordnerinhalt von C:\Programme\ sehen.

Ist dies den möglich?


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 03.02.2007 um 14:31
MH1987
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Sa 03.02.07 13:56 
hi,

versuchs mal damit

ausblenden Delphi-Quelltext
1:
  self.OpenDialog1.InitialDir:= ExtractFilePath(ParamStr(0));					


damit ist der vorgebene ordner der projekt ordner.

gruß,
Matthias
whitef Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 03.02.07 14:20 
Titel: kein erfolg
mh danke für die antwort, funktioniert so leider nicht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button4Click(Sender: TObject);
begin
  if self.OpenDialog1.InitialDir:= ExtractFilePath(ParamStr(0)).Execute then
  begin
    Edit1.Text := OpenDialog1.Files[0]
  end;
end;


auch ohne "self." funktioniert dies nicht...
ausblenden Delphi-Quelltext
1:
if OpenDialog1.InitialDir:= ExtractFilePath(ParamStr(0)).Execute then					


grEEtz whiteF
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 03.02.07 14:27 
Es muss ja auch so heißen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button4Click(Sender: TObject);
begin
  OpenDialog1.InitialDir := ExtractFilePath(ParamStr(0);
  if OpenDialog1.Execute then
  begin
    Edit1.Text := OpenDialog1.Files[0]
  end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
whitef Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Sa 03.02.07 14:31 
Titel: SUPER!!! ERSTKLASSIGER ERFOLG!!!!
ah super!!

Vielen Dank, hat alles super funktioniert, danke Marco.


:CLOSED:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 03.02.07 14:32 
Wer einen Zuweisungsoperator in eine if-Anweisung baut, sollte sich vielleicht mal den Crashkurs Delphi ansehen :zwinker:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".