Furthermore :
As I am an Emulator Fan, I am on my way to make what you call a Terminal emulator
ANDso far mixing TCmdBox , TAsyncProcess plus a OEM to UTF8 translation , I really DO NOT encounter any problem.
2nd day of work (let say 10h) and I am here as follow :
1) I built some embeded commands begining with '!!'
like !!help , !!ver, !!cls, !!clh (clear history), !!bye, !!xitc (get exit code from last task) etc etc
2) I can launch any program or any embeded OS command with their parameters from inside My box by typing exactly the same way I would in a terminal
3) any launched task displays exactly what it would show inside a normal terminal, and I can catch the Exit Code
4) when the running task takes longer than 50 milisecond , 2 disabled buttons on the right of My emulated terminal become enabled with these functions : "Pause/Resume" , "Stop" the current task. these buttons return to grayed while no task active.
5) finally I plan to embed either PascalScript engine in the background, either my own simplified using commands like !!if , !!exist, !!fileage, !!echo(on/off), etc
COOL
...
type
TMyAsyncProcess = class(TAsyncProcess)
...
end;
{ TMainForm }
TMainForm = class(TForm)
cpEdit: TEdit;
Label2: TLabel;
Label3: TLabel;
StopButton: TButton;
CmdBox: TCmdBox;
Label1: TLabel;
PauseTBox: TToggleBox;
procedure CmdBoxOnEnter(Sender: TObject);
procedure CmdBoxOnInput(ACmdBox: TCmdBox; Input: string);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
rdbuf: array[0..8191] of Byte;
protected
CanExit: boolean;
console: TMyAsyncProcess;
procedure WriteHelp;
procedure ConsoleRead(Sender: TObject);
procedure ConsoleExec;
procedure cpChange;
..............
procedure TMainForm.CmdBoxOnInput(ACmdBox: TCmdBox; Input: string);
...
{$IF DEFINED(WINDOWS)}
console.Executable:='cmd.exe'; // My AsyncProcessConsole ;)
console.Parameters.Add('/C');
{$ELSEIF DEFINED(LINUX)}
console.Executable:='/bin/sh';
console.Parameters.Add('-i');
{$ELSE}
{$ERROR this must be compiled under windows or linux}
{$ENDIF}
console.CommandLine:=console.Executable+' '+console.Parameters[0]+' '+Input;
......
... to be continued