Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can VFP know if it's idle for a period of time?
Message
 
 
À
08/08/2001 10:18:52
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00541244
Message ID:
00541741
Vues:
38
>>I have several forms in an app. If there is no user interaction for 30 minutes I'd like to shut VFP6 down. Is there a way to do this without hardcoding a timer in each form that gets reset by control's interactive change, etc.?
>>
>>Thanks,
>>Allen
>
>I think you would need to something like this:
>
>
  • Still use a timer.
    >
  • Set ThisForm.KeyPreview = .T. for each form (do this in your base class).
    >
  • In the Form.KeyPress event, issue Timer.Reset(). This will start counting from zero. (Do this in your base classes, too.)

    Just to add to your suggestion, I wouldn't necessarily reset the timer unless you create a timer only for this purpose. I use one timer throughout my application and it broadcasts messages through the various manager classes that it fired. Objects that receive the message know what they need to do if the timer occurs. All timed events are configured to occur on multiples of the timer interval.

    Ex.
    Timer interval = 6 seconds (1/10th minute)
    Event 1 needs to occur every minute - MOD(TimesTimerEventFired,10) = 0
    Event needs to occur every 10 minutes - MOD(TimesTimerEventFired,100) = 0
    etc.

    Using one timer for everything prevents timer events from stepping on each other toes. It also makes debugging easier in that you only need to shut down one timer (if necessary).

    Just my $0.02.
    Larry Miller
    MCSD
    LWMiller3@verizon.net

    Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
  • Précédent
    Suivant
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform