Autor Beitrag
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 26.04.06 13:45 
Hi@all
Ich kann ja mein Prog in 'Öffnen mit' in Windows einbinden, so dass ich dann meine txt Dateien mit dem prg öffnen könnte. das problem ist nur, dass er jetzt einfach mein prog startet, aber ich den text ja nirgends reinladen kann, weil ich ja gar nicht den pfad der txt-Datei hab.

Kann mir da jemand gelfen?

thx im voraus

Xion
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 26.04.06 14:03 
Mach dich mal schlau über ParamCount und ParamStr.

ParamStr(0) ist der Name der Exe-Datei, ParamStr(1) der erste Parameter (wenn vorhanden). Dort solltest du dann den Dateinamen finden ;-)

_________________
We are, we were and will not be.
Xion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 26.04.06 14:04 
thx, ich guck da mal ;)

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Xion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 26.04.06 14:06 
Wunderbar funktioniert super, danke nochmal :zustimm:

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Xion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 26.04.06 14:10 
hmm, jetzt hab ich aber das problem, dass er ne txt datei immer mit dem txt-editor als standartprogramm öffnet. kann ich dies noch irgendwie ändern, so dass er mein prog immer nimmt?

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 26.04.06 14:13 
Klar, da musst du die Windows-Einstellung verändern. Unter XP geht das irgendwie vom Explorer aus unter Extras->Ordneroptionen->Dateitypen oder so.

Ich glaube auch, dass man beim "öffnen mit"-Dialog einen Haken "Typ immer damit öffnen" auswählen kann.

_________________
We are, we were and will not be.
Xion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 26.04.06 14:15 
ach, stimmt. ich bin ein depp! :wink:

thx für deine hilfe

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
DaKirsche
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187

Win XP Pro, SuSe Linux 7.3 - 10.2, Win 2k3 Server, Win 2000, Win NT 4.0
Delphi 2006 Pro, Java, HTML, SQL, PHP, CSS
BeitragVerfasst: Do 11.05.06 18:12 
Du kannst auch ein Registry Eintrag von deinem Programm automatisch erstellen lassen, damit dein Prog als Standardprogramm gestartet wird....
Unter HKEY_CLASSES_ROOT bei dem Schlüssel txtfile\shell\open\command kannst du
WriteString('','"Laufwerk:\DeinProgrammPfad\DeinProgramm.exe "'+'"%1"') einfügen lassen. Dann wird dein Programm als Standardprogramm für alle Textdateien verwendet.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
uses Registry;
[...]
procedure TForm1.CreateRegistryEntry();
var regist : TRegistry´;
begin
 regist := TRegistry.Create
   try
     regist.RootKey := HKEY_CLASSES_ROOT;
     regist.DeleteKey('txtfile\shell\open\command\');
     regist.OpenKey('txtfile\shell\open\command\', true);
     regist.WriteString('','"'+ParamStr(0)+'" "%1"');
//statt ParamStr(0) kannst du auch den absoluten Pfad deines Programm einfügen.
   finally
 regist.Free;
end;
end;

ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TFrom1.LoadFileIntoMemo1();
begin
if (ParamStr(1) <> '') then 
Memo1.Lines.LoadFromFile(ParamStr(1));
end;