got it. i didn't think about building off them, just about the easiest solution to accomplish what the OP wanted.
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: John Gaughan To: [email protected] Sent: Wednesday, March 18, 2009 6:25 PM Subject: Re: [c-prog] How to load only one instance in Windows startup? Tyler Littlefield wrote: > why would you need a mutex? just check through the process list. > Using a mutex is the more "correct" solution. 1. Mutexes do not rely on the program name: if someone manipulates the files for your program, it may not be able to detect a duplicate instance based on the process list. 2. Mutexes are useful for more than instance checking: it provides a foundation for additional functionality if it is every required, even across completely different programs. 3. Mutexes are more atomic, and there are fewer layers of code. If an instance is defunct but has released its mutex, then another instance will be able to run and will require less user intervention. In general, I try to avoid messing with process lists or manipulating user-visible operating system state. Even in Linux, you would be better off relying on a locking mechanism (an anchor file in /tmp, for example) if Linux does not provide something similar to a mutex (I am not familiar with the POSIX API so I cannot say if it does or does not). -- John Gaughan [Non-text portions of this message have been removed]
