Autor Beitrag
apnm
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mi 21.08.02 23:14 
Hallo

Habe folgendes Prob.
Will ein Konsolen Tool starten, mit Parametern, aber das Problem ist, dass ich alles abfangen will, und zB in nem Memo Feld ausgeben will, was mir das Tool zurückpostet.

_________________
-=] @pNm [=-
Günter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Do 22.08.02 15:51 
Hallo apnm,

Ich hatte mal ein ähnliches Problem, welches ich so gelöst habe:

Die Anwendung muss mit 'CreateProcess' (in der Hilfe --> Windows SDK) gestartet werden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
BOOL CreateProcess(

    LPCTSTR lpApplicationName,  // pointer to name of executable module 
    LPTSTR lpCommandLine,  // pointer to command line string
    LPSECURITY_ATTRIBUTES lpProcessAttributes,  // pointer to process security attributes 
    LPSECURITY_ATTRIBUTES lpThreadAttributes,  // pointer to thread security attributes 
    BOOL bInheritHandles,  // handle inheritance flag 
    DWORD dwCreationFlags,  // creation flags 
    LPVOID lpEnvironment,  // pointer to new environment block 
    LPCTSTR lpCurrentDirectory,  // pointer to current directory name 
    LPSTARTUPINFO lpStartupInfo,  // pointer to STARTUPINFO 
    LPPROCESS_INFORMATION lpProcessInformation   // pointer to PROCESS_INFORMATION  
   );

In der Struktur lpStartUpInfo muss dwFlag mit 'STARTF_USESTDHANDLES' belegt werden, dann kann man für 'hStdOutPut, hStdInput und hStdError' eigene Handles angeben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure Blabla;
var 
  hOutput : Integer;
  STUI : STARTUPINFO
begin

...
  STUI.dwFlags := STARTF_USESTDHANDLES

  {Für Input und Fehlermeldungen die Standard-Handels}
  STUI.hStdInput := GetStdHandle(STD_INPUT_HANDLE);
  STUI.hStdError := GetStdHandle(STD_ERROR_HANDLE);

  {Datei öffnen}
  hOutPut := FileOpen('xyz.txt');

  STUI.hStdOutput := hOutput;

  CreateProcess(...);

...
end;

Jetzt schreibt der gestartete Prozess in die Datei.

Gruss Günter
apnm Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Fr 30.05.03 10:07 
Titel: Handle
Hallo

Ziehmlich spät, dass ich hier nochmal eine Frage habe ;)

Und zwar wegen dem Handle
Gibt es eine Möglichkeit die ganze Sache nicht erst in eine Datei zu stecken, sondern direkt in ein Memo Feld, ich möchte den Umweg über eine Datei vermeiden.
Kann man da nict einfach das Memo Handle mitgeben, oder irgendwie anders?

Wäre um deine Hilfe dankbar

_________________
-=] @pNm [=-
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Fr 30.05.03 21:26 
Schau dir mal Pipes an

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.