Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: So 16.10.05 19:13 
Hi,
ich habe folgendes Beispiel gefunden, um eien Anwendung zu starten und zu warten bis diese weider beendet wurde:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
Procedure RunProcessAndWait (aFilename: String);
Var
  StartupInfo : TStartupInfo;
  ProcessInfo : TProcessInformation;
  Result: Boolean;
Begin
  FillChar (StartupInfo, SizeOf (TStartupInfo), 0);
  StartupInfo.cb := Sizeof (TStartupInfo);

  StartupInfo.dwFlags := STARTF_USESHOWWINDOW OR STARTF_USEPOSITION OR STARTF_USESIZE ;
  StartupInfo.wShowWindow := SW_SHOWDEFAULT;

  Result := CreateProcess (
      nil,
      pChar (aFilename), 
      nil,
      nil,
      False,
      NORMAL_PRIORITY_CLASS,
      nil,
      nil,
      StartupInfo,
      ProcessInfo
    );

  If Result then 
    WaitForSingleObject (ProcessInfo.hProcess, INFINITE); 

  if ProcessInfo.hProcess <> 0 then  
    CloseHandle (ProcessInfo.hProcess); 
End;


Wie kann ich nun aber Parameter an das Programm weitergeben, das gestartet wird ?

thx hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 16.10.05 19:30 
du bist seit 2002 dabei und weißt immer noch nicht das man mal die suche bzw google benutzen kann?

ist bei google soagr auf platz 1 wenn man nach CreateProcess sucht

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
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: So 16.10.05 20:25 
Außerdem sollte Dir in dieser Zeit bereits aufgefallen sein, dass CreateProcess als Filename auch eine gesamte Befehlszeile annimmt; nicht nur einen Dateinamen ;-)

_________________
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.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: So 16.10.05 21:44 
user profile iconuall@ogc hat folgendes geschrieben:
du bist seit 2002 dabei und weißt immer noch nicht das man mal die suche bzw google benutzen kann?

Hätte ich die suche nicht benutzt, dann hätte ich dieses Beispiel garnicht erst gefunden.
user profile iconuall@ogc hat folgendes geschrieben:
ist bei google soagr auf platz 1 wenn man nach CreateProcess sucht

Die mühe hättest du dir auch sparen können, da in dem Post, wo ich den Source gefunden habe, einen Link angeklickt habe und genau auf die gleiche Seite gekommen bin.


user profile iconBenBE hat folgendes geschrieben:
Außerdem sollte Dir in dieser Zeit bereits aufgefallen sein, dass CreateProcess als Filename auch eine gesamte Befehlszeile annimmt; nicht nur einen Dateinamen ;-)

sorry, aber ich habe noch nie mit diesem Befehl gearbeitet :oops: und an sowas einfaches habe ich nicht gedacht, denn bei shellexecute gibt man die Parameter nicht direkt mit dem Dateinamen / dateipfad an.

Das problem hat sich gelöst, danke BenBE für deinen Hinweis :wink:

hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej