Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do i know that my application is deactivated or re-a
Message
De
27/02/2005 04:45:06
Suhas Hegde
Dental Surgeon
Sirsi, Inde
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
00990524
Message ID:
00990953
Vues:
14
>Check How do I detect when VFP is no longer in Foreground FAQ #7957


hi again,

not sure how it works because it didnt work as i expected.
PRIVATE oMyTimer
oMyTimer = CREATEOBJ('tmrShutdownIfNotVFP')
oMyTimer.Interval = 500 && 1/2 second
oMyTimer.Enabled = .T.

*  In another procedure...
DEFINE CLASS tmrShutdownIfNotVFP AS TIMER
   Enabled = .F.
   Interval = 100
   ProcessToWatch = 0
   LastInForeground = NULL 
   nvalue = 1

PROCEDURE Init
   DECLARE INTEGER GetCurrentProcessId IN WIN32API
   this.ProcessToWatch = BITOR(GetCurrentProcessId(),0)  && cast integer
ENDPROC

PROCEDURE Timer
   LOCAL nThisProcessID, lForeground
   DECLARE INTEGER GetWindowThreadProcessId IN WIN32API ;
      INTEGER hWnd, ;
      INTEGER @ lpProcessID
   DECLARE INTEGER GetForegroundWindow IN WIN32API
   nThisProcessID = 0
   =GetWindowThreadProcessID(GetForegroundWindow(),@nThisProcessID)
   lForeground = BITOR(nThisProcessID,0) # this.ProcessToWatch  && cast integer

   IF this.LastInForeground # lForeground
      this.LastInForeground = lForeground
      IF lForeground
          * VFP Got focus
      ELSE
          * VFP Lost focus
      ENDIF
   ELSE
this.nvalue = this.nvalue + 1
     wait window " still in foreground" + alltrim(str(this.nvalue)) * No change in foreground status
   ENDIF
ENDPROC
ENDDEFINE
When i run it and select any other application I still see that the value ticks even though vfp is in the background. What modifications should i have to do to use it??

TIA

suhashegde
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform