Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single instance app
Message
De
24/02/1999 14:26:05
 
 
À
23/02/1999 18:58:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00190737
Message ID:
00191065
Vues:
17
>I remember using the foxtools library to ensure that only one instance of my app was running, but I seem to have misplaced that code :)
>
>Has anyone else used foxtools to accomplish this and could you post / email me a sample of your code?
>
>TIA


How about this Larry?



set libr to foxtools.fll

* FindWindow() takes two parameters and returns the handle of the
* window, HWND, if it was found.
getwind = regfn("FindWindow", "CC", "I")
setactwind = regfn("SetActiveWindow", "I", "I")

*Set the first parameter of the call to getwind to 0, null.
wclass=0
winname="THIS APP" && this should be name that appears in main title bar
apphand=callfn(getwind,wclass ,winname)

*If the call was successful, stop processing.
IF apphand<>0
=msgbox('Cannot run multiple copies of THIS APP','Notice',16)
lastwind=callfn(setactwind,apphand)
QUIT
ENDIF

set libr to


I think I got this from a KB article. HTH
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform