Autor Beitrag
Schakal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50



BeitragVerfasst: Mi 29.10.03 23:36 
Und gleich noch ne Frage :D
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button3Click(Sender: TObject);
begin
        if OpenDialog1.Execute then
        begin
                Projekt := OpenDialog1.FileName;
                Edit1.Text := Projekt;
        end;
end;

hier öffne ich eine datei, nehmen wir an
c:\test\verzeichnis.txt

wie kann ich jetzt einer variable den pfad, also c:\test\ zuweisen?

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.


Zuletzt bearbeitet von Schakal am Do 30.10.03 01:03, insgesamt 1-mal bearbeitet
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mi 29.10.03 23:37 
ausblenden Delphi-Quelltext
1:
Projekt:=ExtractFilePath(OpenDialog1.Filename);					
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mi 29.10.03 23:39 
ausblenden Delphi-Quelltext
1:
extractfilepath(opendialog1.filename);					

gibt auch noch was anderes, und entweder das hier oder das andere liefert am Ende das "\" nicht mit zurück...
einfach mal ausprobieren ;)
Schakal Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50



BeitragVerfasst: Do 30.10.03 00:06 
tnx
noch ne frage, glaube nicht das es sich lohnt für so etwas noch nen neuen thread aufzumachen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.BitBtn3Click(Sender: TObject);
var
        pfad2 : string;
        datei : string;
begin
        Pfad2:=ExtractFilePath(ParamStr(0));
        datei:=Pfad2+('splash.sp');
        CopyFile(PChar(datei), PChar(Pfad),False);
end;

end.

so wie das aussieht, stimmt doch alles, wieso kopiert der die datei nicht?
ShellAPI ist eingefügt. die Variable Pfad ist vorher im programm definiert hab false auch schon durch true ersetzt, klappt auch nicht

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Do 30.10.03 09:28 
Schakal hat folgendes geschrieben:
die Variable Pfad ist vorher im programm definiert
Kann es sein das im Ziel ebenfalls ein Dateiname angegeben werden muß?

barfuesser