Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Switching between Windows apps
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00151887
Message ID:
00152363
Views:
12
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform