> I would like my application to have only one instance of it running at a 
> time.  However I am unsure how to implement this.
> If the user opens another instance the contents of what it opened should go 
> to the already opened instance.
> As an example, I would put emacs.
>
> How would I go about coding this?  Pipes?  Sockets?  None of the above.


[Reposting this response: something weird is going on - I replied to this from 
my phone, on the 16th, but it has not appeared... Wonder if I'm being bounced 
for some reason?... Oh, in fact, a few posts seem to be missing... Maybe the 
forum doesn't like posts from my phone?

Anyway, here's what I said... FWIW!]



Hi Gonzalo,

I used named pipes to do this, since they work ok on WIN32 as well as *nix & 
OSX.

My app tests for the presence of the named pipe on launch; if not found it 
launches a full instance & creates the pipe... If found, a little helper 
function just writes the new file instance onto the pipe then terminates. The 
main app "monitors" the incoming pipe for actions, albeit as a low priority 
background thread.

Seems to work ok, but was a bit of messing about with platform specific code to 
get the pipes to work "transparently" across platforms.

There's probably a better way though!



_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to