Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ER - only allow the app to run once
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00688594
Message ID:
00689117
Vues:
51
Paul,

>I like both approaches (CreateEvent and CreateMutex) more than creating a dummy window because I think there is less of a chance for any unexpected behavior from the "hidden" window (since it will show up in the forms collection).

You're right. I didn't think about that side effect in the Forms collection. But IMO this won't really matter. The only downside that comes to my mind is that when you send a message to all open forms, one more form is called or at least checked for the existance of the method. And this happens only if you're going through VFP's collection. When using the MM Form Manager's collection it doesn't matter at all.

I already thought of simply creating an invisible "Windows" window < g > and checking for it's caption which could be an app ID. This would be the same as Christof's idea, but without the side effect with the form's collection.

>However, both of them suffer from the same limitation of not being able to identify the running apps current window name. If you change the title of your app, FindWin won't find it anymore. The CreateMutex approach assumes the window name won't change. So, I think I'd stay with the current set of code we've got (unless you see another way around this).

That's ok. We can always update the code later, if we change our minds in the future. For now, this will do the job.

Two more things come to my mind:
1) We could use the EXE's name as a default, if the APP-ID is empty.
2) Only check for multiple instances if we are not running in Debug mode. This will allow us to have the development version running in the IDE and a production EXE at the same time for comparing layout things etc.

>BTW - get some sleep ;-)

I had some sleep in the meantime (5 hours) :)

Regards,
Armin

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform