Single instance: open instead of launch Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tessman
Earned some good credits
Earned some good credits
Posts: 109
Joined: Tue Oct 06, 2009 5:25 pm

Single instance: open instead of launch

Post by tessman »

I've looked into this a little (or more than a little) and either I can't find exactly what I'm looking for or it's one of those situations where I'm just being resistant to the truth.

Basically what I want is the ability to mimic the behaviour one gets on Mac for free: i.e., double-clicking an associated document type when an instance of the application is already running will send an "open files" event to that instance instead of launching — as on Windows and Linux — a new instance.

Now, wxSingleInstanceChecker can prevent the launch (or at least terminate after launch to prevent multiple running instances), but before I dig further into two separate platform-specific methods, is there a wx-friendly way of doing this that anyone else has cooked up? (I guess there is DDE, but that seems a little heavyweight for this if there's another alternative.)

Thanks, soldiers.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Single instance: open instead of launch

Post by PB »

I am afraid you are out of luck, see these answers a wxWidgets maintainer gave to similar questions:
https://stackoverflow.com/questions/352 ... 9#35291999
https://stackoverflow.com/questions/459 ... 5#45938145
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Single instance: open instead of launch

Post by doublemax »

The method Vadim described is what i use in my applications. My code as it is is a little messy, but i think it could be turned in a single mix-in class. I'll see if i can strip something together, but it won't be before thursday.
Use the source, Luke!
tessman
Earned some good credits
Earned some good credits
Posts: 109
Joined: Tue Oct 06, 2009 5:25 pm

Re: Single instance: open instead of launch

Post by tessman »

Thanks — figured that would probably be the approach. (I hadn't seen those SO links: thanks for those.)
Post Reply