Jonny, another possibility is the SimpleIPC client and server. Examples at <your-fpc-source>packages/fcl-process/examples/
Possible the .SingleInstance thing you ask about is based on it. When your app starts, try to send a message to the server, if you succeed then you know to exit. If no server present, become server. Once its in place, you may find other uses for that message sending ability. I did.
Showing the running instance ? Here is what I do ....
procedure TSearchForm.MoveWindowHere(Frm : TForm);
begin
if Frm = Nil then exit;
if not Frm.Visible then Frm.Show;
{$ifdef LINUX} // On Linux, the target form may be in another workspace
if not mvxwindow.MvXWinWorkSpace(Frm.Caption) then // drops message to console if fails
begin // Normally, this seems highly unlikely ! Maybe Enlightenment DE ?
Frm.Hide;
Frm.show; // This produces a noticable flicker if the form is already visible
end;
{$else}
Frm.EnsureVisible(True); // All that is necessary in a non-workspace system
{$endif}
end;
I have decided the flicker when Hide-Show is a good thing, it attracts the user's attention.
Davo
PS, a polite response to Thaddy ? Now, thats a novel idea !