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:
00027370
Vues:
26
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
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform