0

All the questions found on SO are about sending window to front, but

How can a Delphi application send its main form to background?

I think no one can object to a launcher software that sends itself to background after launching other executable file.

Update

Below is an example how I launch payload software from launcher

procedure TLauncherForm.Run(const fileName: string);
var
  sinf: TStartupInfo;
  pinf: TProcessInformation;
begin
  sinf := default(TStartupInfo);
  sinf.cb := SizeOf(sinf);
  CreateProcess(PWideChar(fileName), nil, nil, nil, False, 0, nil,
      PWideChar(ExtractFilePath(fileName)), sinf, pinf);
end;
Paul
  • 25,812
  • 38
  • 124
  • 247
  • 1
    In Win32 API, [`SetWindowPos()`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos) with `hWndInsertAfter=HWND_BOTTOM`. In VCL, [`TControl.SendToBack()`](http://docwiki.embarcadero.com/Libraries/en/Vcl.Controls.TControl.SendToBack). In FMX, [`TFmxObject.SendToBack()`](http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.SendToBack). On the other hand, a launcher would typically not need to send itself to the background because the newly spawned process would normally display its windows on top of the launcher by default anyway – Remy Lebeau Aug 19 '19 at 19:56
  • Remy, I encounter from time to time (20% of all the launches) a problem that process is being launched beneath the launcher. Launcher replaces Windows shell. – Paul Aug 19 '19 at 20:07
  • how exactly are you launching the processes? Please show that code. – Remy Lebeau Aug 19 '19 at 20:41
  • @Remy Lebeau: I have updated the question with an example. – Paul Aug 20 '19 at 09:52

0 Answers0