Graeme Geldenhuys wrote:

Example of what I want to achieve. Say I have gEdit (Gnome editor) open
and have a file loaded. Now if I am in a console and type 'gedit
someotherfile.txt' [or double click a text file in Nautilus], it doesn't
start a new instance of gedit, the existing instance opens the new file
- gedit supports multiple opened files in a tabbed view.

How do they accomplish this? I would like to implement something like
that for fpGUI, and it must work under all fpGUI supported "desktop"
platforms.

I know under Windows you can check if an instance of an application is
already running, and stop your current instance. Still not sure how to
transfer the "open a new file" action to that existing instance.

As for Linux, FreeBSD etc, I have no clue how to do it. For those not in
the know, fpGUI is based directly on GDI or XLib (not Qt, GTK etc).

I've done it on Linux by explicitly setting up a unix-domain socket and writing a command to that if the process that created it is still running, Mozilla (Firefox etc.) does similar via an ORB. There's lots of "gotchas" in here: in some cases you want to fork a distinct program instance and having to do so via a separate named profile can be inconvenient.

So far I've had no success porting that to Windows using named pipes, I suggest you look at how lhelp works (and confer with Reinier et al.).

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to