El compilador es un "simple" .exe al cual le das parametros.
Por ejemplo ejecutas en linea de comando: pascal.exe mi_programa.pas
y este te devolverá un mi_programa.exe
El IDE no es más que un "simple" editor de texto.
Eso a grandes rasgos, un ejemplo antiguo pero util.
P.D.: En las páginas de Borland hace unos años, podías descargar su compilador C++ v5.0 completo y completamente gratis (sin IDE).
Cita:
Util por ejemplo para llamar al ARJ, PkUnzip... para llamar al compilador de Java, etc.
En este ejemplo, ejecutamos un comando externo del DOS (ChkDsk.EXE) viendo el resultado del comando en un TMemo:
El ejemplo:
-Pon un TMemo (Memo1) y un TButton (Button1) en tu form
-Mete este código dentro del OnClick de Button1:
|
Código Delphi
[-]procedure TForm1.Button1Click(Sender: TObject);
procedure RunDosInMemo(Que:String;EnMemo:TMemo);
const
CUANTOBUFFER = 2000;
var
Seguridades : TSecurityAttributes;
PaLeer,PaEscribir : THandle;
start : TStartUpInfo;
ProcessInfo : TProcessInformation;
Buffer : Pchar;
BytesRead : DWord;
CuandoSale : DWord;
begin
with Seguridades do
begin
nlength := SizeOf(TSecurityAttributes);
binherithandle := true;
lpsecuritydescriptor := nil;
end;
if Createpipe (PaLeer, PaEscribir, @Seguridades, 0) then
begin
Buffer := AllocMem(CUANTOBUFFER + 1);
FillChar(Start,Sizeof(Start),#0);
start.cb := SizeOf(start);
start.hStdOutput := PaEscribir;
start.hStdInput := PaLeer;
start.dwFlags := STARTF_USESTDHANDLES +
STARTF_USESHOWWINDOW;
start.wShowWindow := SW_HIDE;
if CreateProcess(nil,
PChar(Que),
@Seguridades,
@Seguridades,
true,
NORMAL_PRIORITY_CLASS,
nil,
nil,
start,
ProcessInfo)
then
begin
repeat
CuandoSale := WaitForSingleObject( ProcessInfo.hProcess,100);
Application.ProcessMessages;
until (CuandoSale <> WAIT_TIMEOUT);
repeat
BytesRead := 0;
ReadFile(PaLeer,Buffer[0],CUANTOBUFFER,BytesRead,nil);
Buffer[BytesRead]:= #0;
OemToAnsi(Buffer,Buffer);
EnMemo.Text := EnMemo.text + String(Buffer);
until (BytesRead < CUANTOBUFFER);
end;
FreeMem(Buffer);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
CloseHandle(PaLeer);
CloseHandle(PaEscribir);
end;
end;
begin
RunDosInMemo('chkdsk.exe c:\',Memo1);
end;
Otra forma (fuente descargable):
http://www.ajpdsoft.com/modules.php?...=getit&lid=258
.
.
.