Autor Beitrag
JayK
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Do 19.01.06 18:24 
Hallo Leute,

bitte steinigt mich nicht, ich weiß einfach nicht, wonach ich da suchen soll :( hab wohl grad ein Brett vorm Kopf :autsch: (oder ne rote Wand *g*)

Wie mache ich das in C#, was ich in Delphi über ParamStr(0) mache, also den Pfad meines gerade laufenden Progs ermittle?

Grüße
JayK
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Do 19.01.06 18:41 
Ok, ganz hilflos bin ich wohl doch nicht :angel:
hab jetzt folgendes: Assembly.GetAssembly(this.GetType()).Location (this wäre dann die Inztanz des Formulars).
Ist diese Lösung sauber, oder gibt es eine einfachere?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 19.01.06 19:31 
Hi!

Das Analogon zu ParamStr ist in C# System.Environment.GetCommandLineArgs().

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Do 19.01.06 20:41 
Hmm, bei System.Environment.GetCommandLineArgs()[0] gibt er mir immer den Pfad zu dieser komischen foo.vshost.exe ausm Debug-Verzeichnis meines Projektes wieder :? da bleibe ich wohl vorerst bei meiner Methode.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 19.01.06 20:43 
Natürlich gibt er die heraus, die wird ja auch ausgeführt, wenn Du in der IDE das Programm startest ;-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Do 19.01.06 20:56 
hmm, das is ja doof :( wie soll man denn dann sein Prog testen, wenn es sich selbst mit anderen Paraametern aufrufen soll?
Robert_G
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416


Delphi32 (D2005 PE); Chrome/C# (VS2003 E/A, VS2005)
BeitragVerfasst: Fr 20.01.06 11:31 
user profile iconJayK hat folgendes geschrieben:
hmm, das is ja doof :( wie soll man denn dann sein Prog testen, wenn es sich selbst mit anderen Paraametern aufrufen soll?
Hmpf? :shock:
Die Parameter sind doch gleich, die Echse heißt nur anders....
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Fr 20.01.06 18:25 
als ich Process.Start(System.Environment.GetCommandLineArgs()[0], "/start") genommen hab, hat sich nix getan, was sich tuen müsste, wenn man die exe mit dem Parameter /start aufruft