I have routines that update the database structure when there is a significant change in the applications version number, and sometimes it is difficult
to actually apply the update because users are in the system, but have forgotten, gone to lunch or whatever - so you can't get exclusive control to
make the changes.
Recently, in the last year or so, I have started adding a bit of code to the apps that helps me... When someone selects the database the application opens
a file in a USERS folder beneath the database folder - the app holds this open and never lets it go - it is simply a file called the users name using the
environment variable:
Then, when I need to know who to kick - I just try and delete all the files in the USERS folder and any I can't delete must be logged in:
Not perfect, but functional
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.
to actually apply the update because users are in the system, but have forgotten, gone to lunch or whatever - so you can't get exclusive control to
make the changes.
Recently, in the last year or so, I have started adding a bit of code to the apps that helps me... When someone selects the database the application opens
a file in a USERS folder beneath the database folder - the app holds this open and never lets it go - it is simply a file called the users name using the
environment variable:
Code:
ON ERROR DO FILEERR
IF !DIRECTORY(m.DATALOCATION+"Users")
MD (m.DATALOCATION+"Users")
ENDIF
m.USERHANDLE = FCREATE(m.DATALOCATION+"Users\"+DOS_FILE(GETENV("USERNAME")))
ON ERROR DO USUAL WITH LINENO(),PROGRAM()
Then, when I need to know who to kick - I just try and delete all the files in the USERS folder and any I can't delete must be logged in:
Code:
PRIVATE m.DATALOCATION,m.NUMUSERS,m.STRING
m.DATALOCATION = TRIM(DTAFILES.PATH)
m.STRING = ""
IF !EMPTY(m.DATALOCATION)
m.NUMUSERS = ADIR(ARYUSERS,m.DATALOCATION+"Users\*.*")
FOR I = 1 TO m.NUMUSERS
IF ARYUSERS(I,1) <> "."
ON ERROR DO FILEERR
DELETE FILE (m.DATALOCATION+"Users\"+ARYUSERS(I,1))
IF MYFILE(m.DATALOCATION+"Users\"+ARYUSERS(I,1))
m.STRING = m.STRING + ARYUSERS(I,1)+m.CRLF
ENDIF
ENDIF
NEXT
IF !EMPTY(m.STRING)
MESSAGEBOX("The Following users are Logged in:"+m.CRLF+m.STRING,48,"Active Users")
ELSE
MESSAGEBOX("No Users are Logged in")
ENDIF
ENDIF
Not perfect, but functional
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.