Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Preventing Multiple Intances of an App.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00027307
Message ID:
00027534
Vues:
32
I tried this code and like it better. With my method the screen caption can never change.

However, I am still having the same problem as before. If I start with a "fresh" environment by rebooting my computer and then run my app by clicking my app icon more than once really fast, I can still bring up more than one app. After the app loads for the first time, both my routine and yours works as it should.

Do you or anyone else have this same problem? Any ideas on how to fix it??

--Shawn


>Shawn,
>The way I detect attempts to start up multiple instances is to try to set up a DDE session with the application. If I'm successful I know it is alread running and quit. I do this in my main PRG before doing anything else.
>
>* Check if application is already running
>= DDESETOPTION("SAFETY",.F.)
>gnAchan = DDEINITIATE("EXENAME", "System")
>IF gnAchan != -1
> = MESSAGEBOX("your message", ;
> MB_ICONSTOP + MB_OK, ;
> "Error")
> QUIT
>ENDIF
>RELEASE gnAchan
>* Set up DDE service to prevent user from running multiple copies
>= DDESETSERVICE("EXENAME", "Define")
>.
>.
>* rest of your main code
>.
>.
>* Shutdown DDE before exit
>= DDESETSERVICE("EXENAME", "Release")
>
>Steve
>
>>I was able to prevent multiple instances of my app before. The way I did it was to call the FindWindow API command to see if a window existed.
>>
>>However, since we added a splash screen, users can now click more than once in the time that it takes before the splash screen appears and multiple apps will load.
>>
>>The _SCREEN.Caption at the time of the splash screen is what it should be. I have tried to put a DOEVENTS before calling the splash screen. Nothing seems to work.
>>
>>Any ideas??
>>
>>Also, does anyone have a better way of preventing multiple instances of an app?
>>
>>--Shawn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform