Forced closing of all windows from the outside
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Forced closing of all windows from the outside
I had such a problem. In the system of many modes , many of them use the same database. I open the database , and if the window is exclusive one mode is not closed , then launch another that accesses the same database , naturally causes a programming error because some base to which he refers , busy with other regime.
I would like to be able to forcibly close a previously opened windows and database before you run the new regime , all without even knowing what it was. Very similar to how you can close the application from the Application Manager , the software only. Otherwise you have to manually close the previous window before opening a new one. It's uncomfortable , and not all users are doing.
I would like to be able to forcibly close a previously opened windows and database before you run the new regime , all without even knowing what it was. Very similar to how you can close the application from the Application Manager , the software only. Otherwise you have to manually close the previous window before opening a new one. It's uncomfortable , and not all users are doing.
Re: Forced closing of all windows from the outside
You do this only if the other applications that open the databases are your own applications where you have the source code.
You need to run a thread in all the applications that look for the existence of a file.
If the file exists, the programs all shut down.
Why are you using databases in EXCLUSIVE mode?
You would not be having this problem if they were opened in SHARED mode.
You need to run a thread in all the applications that look for the existence of a file.
If the file exists, the programs all shut down.
Why are you using databases in EXCLUSIVE mode?
You would not be having this problem if they were opened in SHARED mode.
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Forced closing of all windows from the outside
Hi, Roger!
I tell you about the students and show photo on the cover on the background clipper "old sea dog".
I do not open the database in SHARED, since it requires more sophisticated programming (lock, unlock, expectations and the like), but in fact most multi-user access is not required. Just need to close the previously opened window opens when new, but doing it programmatically it when opening a new window, and not very close them manually.
I tell you about the students and show photo on the cover on the background clipper "old sea dog".
I do not open the database in SHARED, since it requires more sophisticated programming (lock, unlock, expectations and the like), but in fact most multi-user access is not required. Just need to close the previously opened window opens when new, but doing it programmatically it when opening a new window, and not very close them manually.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Forced closing of all windows from the outside
You can get the same easy of use without opening exclusively. In your open code, just do a file lock. Then you do not need to be concerned about locking, unlocking, etc. Just don't do any locking.
Cliff
Cliff
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Forced closing of all windows from the outside
Hi, Cliff! How many years - how many winters! Nice to hear from you. Thank you for responding. And could not bring the piece of code? Look what I heaped: http://lc.kubagro.ru/Dima/a.doc Look yourself in the text search
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Forced closing of all windows from the outside
Record number of below zero days in my area this year. Had seen the acknowledgment previously. Thanks.
Re: Forced closing of all windows from the outside
Eugene -
you may take a look at the "TIMEOUT"-option of DCREAD GUI:
This will evaluate "AnyFunction" every n seconds. If "AnyFunction" returns .F., nothing happens. If it returns .T., the dialog is closed - as long as nothing else happened within the "n" seconds. So, "AnyFunction" could check a Get-Set-function "ShutDown" like this:
If you now want to close all dialogs using this, call "ShutDown(.T.)". This should close all those dialogs. Just add the statement "TIMEOUT {n,{||AnyFunction()}}" to all DCREAD GUIs, which is no work with search&replace.
you may take a look at the "TIMEOUT"-option of DCREAD GUI:
Code: Select all
DCREAD GUI ... TIMEOUT {n,{||AnyFunction()}}
Code: Select all
FUNCTION AnyFunction()
IF ShutDown()
RETURN .T.
ENDIF
RETURN .F.
FUNCTION ShutDown(lShutDown)
STATIC lShutDownCreated := .F.
IF PCount()=1
lShutDownCreated := lShutDown
ENDIF
RETURN lShutDownCreated
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Forced closing of all windows from the outside
Thank you, Tom! This is an interesting and useful feature!
Re: Forced closing of all windows from the outside

My code is a little redundantly. Forget "AnyFunction" and use "ShutDown" directly instead.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."