Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Switching between Windows apps
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00151887
Message ID:
00152363
Vues:
13
>>I'm looking for a way for my FoxPro app to detect that the user has switched to another Windows app, desktop or whatever. Also, detect when the FoxPro app becomes the active app again.
>>
>>I'll need to have FoxPro trigger a function in both events.
>>
>>Any suggestions ?
>>
>>- Werner
>
>Hi Werner,
>
>The easiest way to deal with this is to first load foxtools. If you're using the main VFP window, retrieve it's window handle using the MainhWnd() function, other use _WHToHwnd(_WFindTitl(ThisForm.Caption)) to get that. Assuming that you've main the active VFP window handle (either _SCREEN's or Form) as a property of the object (in the example a form) that has the timer, then the following does what you need:
>DECLARE INTEGER GetForegroundWindow IN Win32API
>LOCAL lnhWnd
>lnhWnd = GetForegroundWindow()
>IF lnhWnd # = ThisForm.hWnd
>  * VFP's running
>ELSE
>  * It's something else.
>ENDIF
>hth,

Thanks, guys. This worked out perfectly.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform