Re: GTK+



Thanks for the reply, I can understand the concept of how to do it (have done it in win32), but I am looking for implementation examples or pointers, which works cross platform (atleast runs across Linux and Windows).

Kind Regards,
Natarajan.

Guy Rouillier wrote:
The way this is typically done is to check in main() for any already-running processes, and if present just shut down the newly started one. If you want to be user-friendly, you can give focus to the already running version so the user is not left wondering why the app didn't start.

One tricky part is that the user may have renamed the executable, so don't hard-code the name of your app inside main. Instead, identify the name under which it was started in main(). To be even more fool-proof (since the user may rename the executable between the first and second invocations), you can create some type of signal (e.g., semaphore) when the first instance of the app is run. Subsequent instances can just look for the presence of that signal.

natarajan wrote:
Hi all,
Is there a way in GTK+ which I can use to stop users from running multiple instances of an application program. I am looking for this as I want my program to work cross platform, in windows as well as in Linux.

Many Thanks for your time and response in advance,
Kind regards,

Natarajan.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]