Forum > General

Set Program in background - How ?

(1/1)

nesa24:
I want to make program that starts external exe and kill's it after some time
this is code
**************
program start_kill;

 uses
   Classes, SysUtils, Process;

 var
   AProcess: TProcess;
   BProcess: TProcess;

{$IFDEF WINDOWS}{$R shakeme_gotovo.rc}{$ENDIF}

 begin
   AProcess := TProcess.Create(nil);
   AProcess.CommandLine := 'C:\WINDOWS\System32\dxdiag.exe';
   AProcess.Options := AProcess.Options;
   AProcess.Execute;
   while AProcess.Running do
   begin
   sleep(1000);
   BProcess := TProcess.Create(nil);
   BProcess.Commandline := 'C:\Windows\system32\tskill.exe dxdiag';
   BProcess.Options := BProcess.Options;
   BProcess.Execute;
   end;
   AProcess.Free;
   BProcess.Free;
 end. 
*****************

Now i dont want it to popup/take fokus but only to start and kill proces without notifications
How to set program in background ?

Best regards to all  ;D

mrdebug:
I think you can't. I think that the program itself that you want to start must be executed in background mode. If you want that the program mustn't displayed on the desktop you must run the main program like a service.

Imants:
You can use TSimpleICPClient and TSimpleIPCServer (under system tab)
You can send and recieve mesages between two local applications using these two components

Navigation

[0] Message Index

Go to full version