Autor Beitrag
JungerIslaender
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Di 18.03.08 21:05 
Hi
wie kann ich mit delphi eine text datei öffnen??
Damit meine ich: wenn ich auf den button Hilfe drücke, wird die datei hilfe.txt geöffnet(mit wordpad).


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Di 18.03.2008 um 20:10
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: Di 18.03.08 21:22 
Du meinst, du möchtest die Datei mit einem anderen Programm öffnen?

Such mal nach ShellExecute
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Di 18.03.08 21:58 
Alos da hab ich jetzt das hier gefunden: ShellExecute(Application.Handle,'open',<HTML>,nil,nil,SW_SHOW);

Da sagt er mir aber: [Fehler] Unit1.pas(259): Undefinierter Bezeichner: 'ShellExecute'

Also pls help me.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Di 18.03.08 22:08 
So hab jetzt gesehen, dass ich shellapi zu uses hinschreiben muss. Gesagt getan.(Woher soll man dass auch wissen)
Dennoch passiert nachdem ich den Button gedrückt habe nichts.

ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle,'open','Hilfe.txt',nil,nil,SW_SHOW);					
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: Di 18.03.08 22:25 
Du solltest auch den Pfad mit angeben, nicht einfach nur den Dateinamen.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Di 18.03.08 23:21 
Hi,

Wenn sich die Hilfe im Selben Ordner/einem Unterordner desselben Ordners befindet wie das Programm geht das so:
ausblenden Delphi-Quelltext
1:
extractfilepath(paramstr(0));  //Pfad der ausgeführten Exe ermitteln					


mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
ZSKing
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33

Win XP SP 2
Delphi 2005 PE, Delphi, Pascal, PHP, HTML
BeitragVerfasst: Mo 24.03.08 00:09 
Ich will einen simplen Updater in mein Programm implementieren. Ich habe mir das so vorgestellt, dass das Hauptprogramm die Updater.exe öffnet und die dann das neueste downloadet und in das richtige Verzeichnis packt... Weil intern geht es ja nicht, wenn das Programm geöffnet ist! :)

Naja egal da müsst ihr euch ja nicht drum kümmern, aber ich habe mit dem Aufrufen der Updater.exe Probleme:

ausblenden Delphi-Quelltext
1:
2:
pfad := ExtractFilePath(Application.ExeName);
ShellExecute(Application.Handle,'open',pfad+'Updater.exe',nil,nil,SW_SHOW);


Da zeigt er mir inkompatible Typen an... Wie soll ich das gestalten?
Danke, ZSKing
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 24.03.08 00:43 
Wenn ich mich recht entsinne, musst Du den übergebene String Deines Pfades zusächlich Type-Casten via PChar(). ;)

Cheers,
Marc.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mo 31.03.08 16:31 
SO wie genau müsste jetzt der Quelltext lauten(nachdem ich die shellapi in die uses geschrieben hab) damit ich die Datei Hilfe.txt mit dem standard Browser oder Editor öfnnen kann.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mo 31.03.08 16:44 
ausblenden Delphi-Quelltext
1:
ShellExecute(handle,PChar('open'),PChar('hilfe.txt'),PChar(''),PChar(ExtractFilePath(Application.Exename)),SW_SHOW);					

Eigentlich ist die Funktion doch gut dokumentiert...

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell