Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do i know that my application is deactivated or re-a
Message
From
27/02/2005 04:45:06
Suhas Hegde
Dental Surgeon
Sirsi, India
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
00990524
Message ID:
00990953
Views:
15
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform