Autor Beitrag
The...
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 12.09.05 21:55 
hi,
habe das hier geschrieben:
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open',(ExtractFilePath(ParamStr(0))+'test.exe'),nil, nil, SW_SHOW);					


es sollte eine exe öffnen die in den ordner liegt wo auch die .exe des programmes gespeichert ist.
leider geht es nicht... :(

Warum?

:D danke schon mal :D

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Di 13.09.2005 um 00:08
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 12.09.05 21:58 
Kontrollier mal was ExtractFilePath(ParamStr(0))+'test.exe' wirklich für ein String ist (schreib das mal als Text in ein Label. ich glaub ExtractFilePath(ParamStr(0))ist mehr als nur der Pfad der ausfürenden exe
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 12.09.05 22:04 
Du musst einzeln Exe-name, Pfad der Exe und Ausführungspfad angeben...

Nebenbei In ExtractFilePath (ParamStr(0)) steht genau der Pfad der EXE inklusive '\'...
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 12.09.05 22:08 
oh... gut.

vllt hilft auch schon ein PChar vor (ExtractFilePath(ParamStr(0))+'test.exe'),nil,nil
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 12.09.05 22:40 
also nun bin ich durcheinander!

und er sagt:

[Error] Unit2.pas(29): Incompatible types: 'String' and 'PAnsiChar'

was heißt das 'PAnsiChar' ?

wenn ich
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open','c:/test.exe',nil, nil, SW_SHOW);					


nehme, geht es!
also bekommt er das mit der exe suchen nicht hin?!

Aber ich brauche das.... :(

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 12.09.05 22:57 
Guck in der Delphi Hilfe unter datentypen, da steht es.

Shellexecute ist eine Windows Funktion, die als Datentyp einen P(Ansi)Char erwartet und mit einem AnsiString nichts anfangen kann. Stringliterale werden per Compilermagic automatisch zu einem PChar gecastet. Übergibst du eine Variable musst du den Cast selber vornehmen:
ausblenden Delphi-Quelltext
1:
Shellexecute(Handle, 'open', PChar(MeinPfadZurExe), nil, nil, SW_NORMAL);					
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 12.09.05 23:45 
na das gibt jetzt aber mal nen genz dicken DAUMEN @all für all die hilfe und tips ! :D

nun hab ichs, danke @Luckie !

Mein Code war ja noch nicht mal nah drann... :?

aber nun gehts ja :)