Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I want to close a VFP app when it loses focus, but...
Message
De
01/10/2000 00:35:33
 
 
À
01/10/2000 00:28:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00421030
Message ID:
00423211
Vues:
27
Tested:
*  At startup
PUBLIC 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
   
PROCEDURE Init
   DECLARE INTEGER GetCurrentProcessId IN WIN32API
   this.ProcessToWatch = BITOR(GetCurrentProcessId(),0)  && cast integer
ENDPROC

PROCEDURE Timer
   LOCAL nThisProcessID
   DECLARE INTEGER GetWindowThreadProcessId IN WIN32API ;
      INTEGER hWnd, ;
      INTEGER @ lpProcessID
   DECLARE INTEGER GetForegroundWindow IN WIN32API
   nThisProcessID = 0
   =GetWindowThreadProcessID(GetForegroundWindow(),@nThisProcessID)
   IF BITOR(nThisProcessID,0) # this.ProcessToWatch  && cast integer
      ? 'Die, VFP, die!'
      *  We're out of all VFP Windows
   ENDIF
ENDPROC
ENDDEFINE
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform