Autor Beitrag
mexx
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 12:12 
Hallo,

wie kann ich beim Aufruf einer Anwendung mehrer Parameter übergeben, die dann an eine Procedure übergeben werden.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  if ParamCount>0 then begin
    if ParamStr(1)='/x' then begin
      ...
    end;
  end;


Soweit ist alles klar, aber wie kann ich nun hinter dem /x werte auslesen lassen?, die ich dann weitergebe?

Gruß

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 06.10.05 12:16 
mit copy und pos ?
schau mal in der open source sparte oder auf meiner homepage nach consolenprogrammen, dann siehst du genau wie das gemacht wird.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 12:24 
Hmm, auf deiner Page geschaut, finde aber nix!
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 06.10.05 12:28 

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 12:45 
nein, funktioniert auch nicht. er bekommt keinen wert. die variable bleibt leer
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 06.10.05 12:49 
?

psview.dpr hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var s: string;
...
  if paramcount = 0 then begin // keine parameter
    writeln;
    writeln('pid  procname');
    writeln(findAllProcesses(true,false));
  end
  else begin
    s:=paramstr(1);
    if uppercase(copy(s,1,3)) = '/K:' then begin
       pid := strtoint(copy(s,4,length(s)));
       if pid > 0 then if KillProcess(pid) then
         writeln('pr0c3ss k1ll3d.')
       else writeln('failed t0 k1ll process');
       goto finish;
    end;
    if uppercase(copy(s,1,3)) = '/F:' then begin
       delete(s,1,3);
       pid := findprocess(s);

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 06.10.05 12:51 
Wie übergibst Du denn die Parameter? Retnyg geht davon aus, das Du das so machst
ausblenden Quelltext
1:
MyApp.EXE /P:Parameter /Q:AnotherOne ....					

Und du?
ausblenden Quelltext
1:
MyApp.EXE /P Parameter /Q AnotherOne					

_________________
Na denn, dann. Bis dann, denn.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 12:53 
ich glaube wir reden aneinander vorbei. es soll zunächst keine consolenanwendung sein. ich brauche die integer nach dem /x

ausblenden Quelltext
1:
bla.exe /x 12 30 14 00					


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var q,w,e,r : integer;
begin

q := 12;
w := 30;

so in der art. ich will die zahlen nach dem x variablen zuweisen, damit ich sie übergeben kann.

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 06.10.05 12:59 
ausblenden Delphi-Quelltext
1:
2:
for i := 2 to paramcount do 
   showmessage(paramstr(i));

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 13:08 
sorry, dass ich heut so aufm schlauch stehe, und wie weise ich den ergebnissen nun den variable zu?
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 06.10.05 13:24 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
For i:=1 To ParamCount Do
  If ParamStr(i)='/x' Then begin
    q:=StrToInt(ParamStr(i+1));
    w:=StrToInt(ParamStr(i+2));    
    x:=StrToInt(ParamStr(i+3));
    y:=StrToInt(ParamStr(i+4));
    End;

_________________
Na denn, dann. Bis dann, denn.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 06.10.05 13:28 
habs alleine rausbekommen. man macht es sich manchmal schon ganz schön schwer thx