Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent same program to be open multiple times on a syst
Message
 
To
12/07/2004 12:29:56
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00923397
Message ID:
00923403
Views:
23
** declare the windos api functions
declare integer GlobalAddAtom in win32api string
declare integer GlobalFindAtom in win32api string
declare integer GlobalDeleteAtom in win32api integer

* need a location to hold the atom for exiting. made public
* here, could be a property of a class.
public natom

** when creating a name for the atom it has nothing to do with the window name.  so make the name anything.  
** it is not case senstive abc = ABC

** if the atom exist from previous load it will return a 
** positive number
if GlobalFindAtom('any name') > 0
   quit 
else
   natom = GlobalAddAtom('any name')  && create atom for the app
endif

I say use any name, but the name must be consistant.  doing a find and add atom will be with the same name.
** at the end of the program just before exiting
** destroy the atom
GlobalDeleteAtom(natom)

it is importen to destroy the atom, for it is not automaticly destroyed on exit.  which will mean that the program will not run again, untill the system is restarted.

quit foxpro
>Hi,
>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.
>Thank You,
>-Justin-
Previous
Reply
Map
View

Click here to load this message in the networking platform