Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chiusura di applicazione dimenticata aperta o inattiva.

Status
Not open for further replies.

bd81031

Programmer
Aug 26, 2017
5
IT
Mi sono da poco registrato e saluto tutti, ho cercato nelle FAQs di risolvere il problema della chiusura automatica dell'applicazione lasciata aperta o inattiva da un certo tempo (in rete) dall'utente, poichè devo aprire in exclusive le tabelle del DataBase per l'indicizzazione e il PACK. In merito ho preso in considerazione i seguente codice :

How do I auto release or shut application on inactivity ? by ramani
faq184-4467
Posted: 21 Nov 03 (Edited 21 Nov 03)
**********************************************************
* Author : Ramani (Subramanian.G)
* FoxAcc Software / Winners Software
* Type : Freeware with reservation to Copyrights
* Warranty : Nothing implied or explicit
***********************************************************
** How to AutoClose a form or application.
**
#IF .f. && Just to avoid explanations from being run
* 1. Add this Timer class definition at the end of your Main.Prg
*
* Timer Class to shutdown
* Set the interval as half of inactivity time
* i.e. if you want to shut in 10 minutes of inactivity
* set timer interval as (5 Min * 60 Sec * 1000 milli)
DEFINE CLASS ShutTimer AS Timer
Interval = 10 * (60*1000/2) && 10 minutes
Name = "ShutTimer1"

PROCEDURE Init
IF VARTYPE(ptLastUsed) = "U"
PUBLIC ptLastUsed
ENDIF
m.ptLastUsed = DATETIME()
ON KEY LABEL MOUSE m.ptLastUsed = DATETIME()
ENDPROC

PROCEDURE Timer
IF ( DATETIME()- m.ptLastUsed )*1000 > This.Interval * 2
* ThisForm.Release && if only form to be released
DO myShutDown && if application to be shutdown
ENDIF
ENDDEFINE
** Enddefine
**************************************************
* 2. ADD in the KeyPress Event of the form..
m.ptLastUsed = DATETIME()
**************************************************
* 3. Set the forms property KeyPreview = .t.
**************************************************
* 4. Add the following code in the Init of the form.
WITH ThisForm
.AddObject("oTimer","Timer")
ENDWITH
**************************************************
* 5. Add a myShutDown procedure to the end of Main.Prg
PROCEDURE myShutDown
CLEAR EVENTS
QUIT
**************************************************
** 6. Add the follwoing code at the beginning of your Main.PRG
ON SHUTDOWN DO myShutDown
**************************************************
#ENDIF && end of explanations
**************************************************
Non riesco ad utilizzarlo in una normale FORMS mia tipo CLIENTI o all'avvio dell'applicazione in fase di autenticazione dell'utente.
Grazie per eventuali suggerimenti o indicazioni.
 
bd81031
Have you taken into account a timer to cause the restart?



Hai preso in considerazione un timer per causare il riavvio?

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
E' proprio un timer che sto cercando di impostare nell'aplicazione, senza provocare danni alle tabelle aperte, ma nei seguenti casi: 1- partono con il programma, ma non danno le credenziali di accesso, 2-lasciano una finestra aperta in fase di input dati. Il codice di cui allegato funziona, per il primo punto inserendolo in menu.prg ma non quando si fermano alle credenziali di accesso, mentre per il punto 2, non riesco a farlo girare.
 
Hi,
Than make a condition to deal with your 1) and 2) in which case the shutdown should not be activated.
For 1) I suggest not to even open your application.
Regards,
Jockey2



Dal momento che questo è un forum inglese ho rifiutato di rispondere in italiano
 
Sorry if I write in Italian, but I'm Italian, if you do not want to answer ITALIANI tell it. I do not see the issue of writing since it's easy to exchange news with the dealers today.
Greetings...
 
Yes, we want to answer in English, this is an English forum. Just like we want you to ask in English. You want us to do something for you, so it's only fair that we expect you to do an effort for us. We don't expect perfect English, but we want people to do their best. If you are a programmer, you are more or less forced to read English books, Help files and websites in English anyway, so English can't be completely incomprehensible to you. Please forgive me if I am wrong, but I think you should be able to make yourself understood in English also. I'm in the same boat as you, you don't expect me to ask in Norwegian, do you? :)

Please believe me, absolutely no offense meant.

Also have a look at
 
bd81031 - I can't tell if you got your answer or not. I hope you did.

The intent of this forum is to:
1) not only help YOU find answers to your issues
2) but also to help OTHERS who may need answers to the same issue.

In addition to visually looking over the posts, those 'Others' may very likely use the SEARCH utility to find a posting and they wouldn't find your posting since their search phrase (in ENGLISH) would not match yours (not in English).

If you write out your question in another language the majority of users (MVP's and others) will NOT be able to offer replies/advice/suggestions to use since most of them do not speak that other language.

Additionally if you write out your question in another language which the majority of uses do not understand, then your post and its replies will NOT be of any use to the OTHERS.

In order for YOU to get the greatest number of applicable replies and for OTHERS to benefit from your question, you should post in the forum's primary language.
By looking at any specific part of this overall forum, you can see that it's primary language is English.

While there is no RULE against doing otherwise - next time, please post your question in English so that you can get replies/advice/suggestions from the majority of users and also so that the majority of Others may also benefit from the Posting and Replies.

And, as Tore has already said: Please believe me, absolutely no offense meant.

Good Luck,
JRB-Bldr
NOTE to Mike Lewis: That's JRB in Boulder, CO, USA (It's much simpler/quicker to write the short-hand)
 
Ok, sorry is all clear, so coming back from the beginning can I cancel the question in Italian and rewrite it in English or leave it all so ? Greetings.
 
Hey Tore, I'd be happy for you to ask your questions in Norwegian. :)

bd81031, don't cancel this thread, I would just say, re-write your original question then in English and add it to this discussion.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I tried in the FAQs to fix the problem, but without a good result, so I would need to automatically close the open or inactive application (on the net) as I need to index and make the PACK to the tables. Thanks for collaboration.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top