Recent

Author Topic: Set Program in background - How ?  (Read 5165 times)

nesa24

  • New member
  • *
  • Posts: 8
Set Program in background - How ?
« on: May 04, 2010, 10:54:40 am »
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

  • Full Member
  • ***
  • Posts: 160
Re: Set Program in background - How ?
« Reply #1 on: May 05, 2010, 08:27:07 am »
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

  • Full Member
  • ***
  • Posts: 198
Re: Set Program in background - How ?
« Reply #2 on: May 05, 2010, 02:38:52 pm »
You can use TSimpleICPClient and TSimpleIPCServer (under system tab)
You can send and recieve mesages between two local applications using these two components

 

TinyPortal © 2005-2018