![]()  | 
	
 
  | 
| 
	 | 
| 
		 
			 
			#1  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 вопрос, можно ли это сделать средствами Delphi 
		
	
		
		
		
		
		
	
		
		
	
	
	имеем форму с двумя Edit и Mемо (ну или нечто похожее) + кнопка вводим в первый Edit *.exe вводим во второй Edit некий параметр нажимаем на кнопку и получаем в Мемо содержимое консоли если можно, подскажите как  | 
| 
		 
			 
			#2  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 Примерно так: 
		
	
		
		
		
		
		
	
		
		
	
	
	Код: 
	procedure RunDosInMemo( CmdLine: string; AMemo: TMemo );
const
  ReadBuffer = 2400;
var
  Security: TSecurityAttributes;
  ReadPipe, WritePipe: THandle;
  start: TStartUpInfo;
  ProcessInfo: TProcessInformation;
  Buffer: Pchar;
  BytesRead: DWord;
  Apprunning: DWord;
begin
   Screen.Cursor := CrHourGlass;
   with Security do
   begin
      nlength := SizeOf( TSecurityAttributes );
      binherithandle := true;
      lpsecuritydescriptor := nil;
   end;
   if Createpipe( ReadPipe, WritePipe, @Security, 0 ) then
   begin
      Buffer := AllocMem( ReadBuffer+1 );
      FillChar( Start, Sizeof( Start ), #0 );
      start.cb := SizeOf( start );
      start.hStdOutput := WritePipe;
      start.hStdInput := ReadPipe;
      start.dwFlags := STARTF_USESTDHANDLES + STARTF_USESHOWWINDOW;
      start.wShowWindow := SW_HIDE;
      if CreateProcess( nil, PChar( CmdLine ), @Security, @Security, true,
                        NORMAL_PRIORITY_CLASS, nil, nil,  start, ProcessInfo ) then
      begin
         repeat
            Apprunning := WaitForSingleObject( ProcessInfo.hProcess, 100 );
            ReadFile( ReadPipe, Buffer[0], ReadBuffer, BytesRead, nil );
            Buffer[BytesRead] := #0;
            OemToAnsi( Buffer, Buffer );
            AMemo.Text := AMemo.text + string( Buffer );
            Application.ProcessMessages;
         until ( Apprunning <> WAIT_TIMEOUT );
      end;
      FreeMem( Buffer );
      CloseHandle( ProcessInfo.hProcess );
      CloseHandle( ProcessInfo.hThread );
      CloseHandle( ReadPipe );
      CloseHandle( WritePipe );
   end;
   Screen.Cursor := CrDefault;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
   Memo1.Clear;
   Button1.Enabled := false;
   RunDosInMemo( 'ping 127.0.0.1', Memo1 );
   // RunDosInMemo( 'net send 127.0.0.1 Привет', Memo1 );
   Button1.Enabled := true;
end; | 
| 
		 
			 
			#3  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Попробую 
		
	
		
		
		
		
		
	
		
		
	
	
	авось получиться  | 
| 
		 
			 
			#4  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Ни чего не вышло, 
		
	
		
		
		
		
		
	
		
		
	
	
	зависает намертво, выполнение Net Send происходит после принудительного завершения exe а с Edit вообще труп  | 
| 
		 
			 
			#6  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Спасибо вам! 
		
	
		
		
		
		
		
	
		
		
	
	
	разобрался!  |