I have a Delphi program (say MyProgram.Exe) that is associated with a particular file extension - lets say '.XXX' files for arguments sake.
When I double click on the file Fred.XXX in explorer, it launches MyProgram.Exe. This is good. If I double click another file in Explorer (say Fred2.XXX) it launches *another* copy of MyProgram.Exe. This is Bad.
I can prevent this simply by putting some code in the start of MyProgram.Exe that looks for another instance running and, if it finds it, sends a message to the other instance to tell it what file to load before terminating itself.
This seems very messy though, and it prevents the user from EVER running two copies of MyProgram.Exe together.
Other programs (such as Microsoft Word) seems to handle this properly, so how do I do it my own software ??
Thanks in advance,