I have an application that prevents multiple invocations of an accessory but standalone app by broadcasting a message, which if answered appropriately prevents another launch. That method might be employed to stop a program loading for a second time. The facilities exist already in CW+
Bill says that this is to solve problems of two or more instances of a program trying to access the same file(s), and of course, that can be resolved by making each instance of a program use its own files. FTN95 has a routine to produce unique filenames for scratch files, for example.
Otherwise, one always has a choice between an MDI program or multiple instances of an SDI program if the user is to be allowed to operate on multiple datasets at the same time. I have always opted for the latter, largely because it does not require a fresh memory allocation for each MDI document – running multiple instances of an SDI program does it for you. Incidentally, I’m lost in admiration for those with the mental agility to program MDI ! Also, my personal experience of MDI apps is that sometimes I go to close off one window and accidentally shut off the lot – and that’s with commercial software where I would expect something better than a brief warning that is accepted with a mouse click ‘bounce’ ! I don’t do this so often with multiple SDI apps, particularly my own, as they usually display a nice big picture and that tells me better than anything else which one I want to shut down.
It does seem to me that if Paul was so minded, he might be better placed than anyone to create a routine to do Bill’s job: I suggest a name - FORBID_MULTIPLE_INSTANCES@
Eddie