Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Shellexecute will nicht (https://www.delphipraxis.net/30573-shellexecute-will-nicht.html)

Florian H 26. Sep 2004 16:40


Shellexecute will nicht
 
Hallo,

ich habe eine konsolenanwendung mit folgendem Befehl:
Delphi-Quellcode:
  shellexecute(0, nil, pchar(extractfilepath(paramstr(0))+'pisg.pl'), nil, nil, 0);
Das sollte ja eigentlich jetzt die pisg.pl (=PERL-Script) starten.
Ich erhalte aber als Rücgabe-Wert "42" und das Script wird nicht gestartet (ist mit dem PERL-Interpreter verbunden, im Explorer reicht doppelklick). Was heißt das jetzt? Was kann ich dagegen tun?

grüße
flo

Nightshade 26. Sep 2004 16:55

Re: Shellexecute will nicht
 
Versuch mal :


Delphi-Quellcode:
shellexecute(0, nil, pchar(IncludeTrailingPathDelimiter(extractfilepath(paramstr(0)))+'pisg.pl'), nil, nil, 0);

Florian H 26. Sep 2004 17:49

Re: Shellexecute will nicht
 
hallo,

hilft leider auch nichts :(

fkerber 26. Sep 2004 17:53

Re: Shellexecute will nicht
 
Hi!

Probier doch mal das:

Delphi-Quellcode:
shellexecute(0, 'open', pchar(IncludeTrailingPathDelimiter(extractfilepath(paramstr(0)))+'pisg.pl'), nil, nil, 0);
Ciao Frederic

Florian H 26. Sep 2004 18:03

Re: Shellexecute will nicht
 
hm klappt auch nicht.

Ich habe auch mal versucht, die perl.exe direkt zu starten und als parameter dann das file. geht aber genausowenig :?

ich versteh nicht woran das liegt... ist ja nicht das erste mal dass ich ShellExecute verwende...

Florian H 26. Sep 2004 18:06

Re: Shellexecute will nicht
 
nichtmal
Delphi-Quellcode:
shellexecute(0, 'open', pchar('c:\perl\bin\perl.exe'), nil, nil, 0);
in einer ganz normalen Win32-Anwendung funzt :(
Mag der da keine Konsolenprogs starten (perl.exe)?

sakura 26. Sep 2004 18:10

Re: Shellexecute will nicht
 
Also nur zur Information, der Aufruf selbst muss erfolgreich sein, da ein Rückgabe-Wert größer als 32 Erfolg bedeutet ;-) Quelle: MSDN

Kann es sein, dass Du "Gänsefüßchen" um den Pfad zum Script machen musst ;-)

...:cat:...

Nightshade 26. Sep 2004 18:11

Re: Shellexecute will nicht
 
und :
Delphi-Quellcode:
CreateProcess(PChar(command), PChar(params), nil, nil, true, CREATE_NEW_CONSOLE, nil, nil, nil, nil);
?

Luckie 26. Sep 2004 18:11

Re: Shellexecute will nicht
 
Gib mal das Arbeitsverzeichnis mit an.

Nicolai1234 26. Sep 2004 18:15

Re: Shellexecute will nicht
 
Zitat:

Zitat von Florian H
nichtmal
Delphi-Quellcode:
shellexecute(0, 'open', pchar('c:\perl\bin\perl.exe'), nil, nil, 0);
in einer ganz normalen Win32-Anwendung funzt :(
Mag der da keine Konsolenprogs starten (perl.exe)?

Ich kenn mich da nicht so aus, abermuss das nicht so gehen:

Delphi-Quellcode:
shellexecute(0, 'open', pchar('c:\perl\bin\perl.exe'), nil, nil, SW_NORMAL);
(dass da SW_NORMAL statt 0 steht?)

Florian H 26. Sep 2004 18:19

Re: Shellexecute will nicht
 
Zitat:

Zitat von Nicolai1605
...
Delphi-Quellcode:
shellexecute(0, 'open', pchar('c:\perl\bin\perl.exe'), nil, nil, SW_NORMAL);
(dass da SW_NORMAL statt 0 steht?)

:wall: :wall: :oops:

Irgendwie habe ich es geschafft, bisher ohne das auszukommen.... DANKE! Jetzt gehts!
Danke auch an die anderen für die Geduld mit mir :cyclops:

sakura 26. Sep 2004 18:19

Re: Shellexecute will nicht
 
Zitat:

Zitat von Nicolai1605
Ich kenn mich da nicht so aus, abermuss das nicht so gehen:
[...]
(dass da SW_NORMAL statt 0 steht?)

0 ist hier der Wert für SW_HIDE, was bedeutet, dass das Programm "versteckt" ausgeführt werden soll.

...:cat:...


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:36 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz