Autor Beitrag
Fabian E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Mi 16.07.08 12:40 
Hallo,

ich habe ein Problem im Zusammenhang mit ShellExecute.

Mit folgender zeile möchte ich in einer Konsolenanwedung eine andere exe öffnen.
ausblenden Delphi-Quelltext
1:
ShellExecute(0, PChar('open'), PChar(SetupPath), PChar(''), PChar(''), SW_SHOW);					


Dies klappt allerdings seit neustem nicht mehr. Warum das so ist kann ich nicht sagen, ich habe absolut keine Ahnung.
Das Problem ist, dass die Exe erst gestartet wird nachdem das Konsolenprogramm geschlossen wurde...
Der Code der nach dem Aufruf steht klappt aber wunderbar. Es wird nur kurz der Zeiger für Hintergrundaktivität angezeigt und dann macht das Programm ganz normal weiter...
Bzw auch nicht weil ich darauf warte, dass der Prozess gestartet wurde, was aber ja nicht der Fall ist.

Schließe ich nun das Programm, so wird sofort meine Exe gestartet... :(
Ich habe keinerlei Ahnung was da schief läuft...
Als Rückgabewert von ShellExecute bekomme ich 42.

Vielleicht kann mir ja jemand helfen :)

gruß
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 17.07.08 10:22 
msdn.microsoft.com/e...ibrary/ms681381.aspx

--> Scheint wohl, du hast die richtige Frage gestellt ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Apollo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Windows 7
Delphi 3 Prof., Delphi 2005
BeitragVerfasst: Do 17.07.08 10:58 
ausblenden Delphi-Quelltext
1:
ShellExecute(0nil, PChar('C:\Das zu öffnente Programm.exe'), nilnil, SW_SHOWNORMAL);					

In uses Shellapi nicht vergessen, sonst wird's nix :wink:

_________________
Im Zweifelsfall immer das Richtige tun