Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prevent same program to be open multiple times on a syst
Message
 
 
À
12/07/2004 12:29:56
Justin Roper
The Cadle Company
Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00923397
Message ID:
00923490
Vues:
20
Justin,

Here is another simple VFP approach provided your app has a static caption while it's running:
lcSavedCaption = _screen.Caption && save the ultimate caption
_screen.Caption = _screen.Caption + sys(2015) && alter this instance so it won't find itself

declare integer FindWindow in win32api ;
  string lpClassName, ; && pointer to class name
  string lpWindowName && pointer to window name

lnHwnd = FindWindow( .null., lcSavedCaption )
if ( lnHwnd > 0 )
   return .f. && already running
endif

* not currently running so it's ok to start, restore the caption

_screen.Caption = lcSavedCaption
>There is a program I wrote in Visual FoxPro 8 that is used on a network by about 100 users in a company. This program is copied to the C: Drive and it is called proj1.exe. I want to prevent a user from opening this program more than once on a single machine. Is there a way to do a quick check to make sure the program isn't already open before it tries to open it again? If anyone has any suggestions, they would be greatly appreciated.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform