Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Active Window
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00555370
Message ID:
00555419
Views:
32
>Hi
>
>For example, I have word, internet explorer and a vfp application
>How can I determine if vfp application is the active window?
>
>TIA

Use the API fuction GetForegroundWindow() and compare its results to VFP's window. Depending on the type of application (and version of VFP), you may have to use Foxtools as a help.
DECLARE INTEGER GetForegroundWindow IN Win32API
* Assuming an MDI application with VFP 7.0
lnactive = GetForegroundWindow()
IF _VFP.hwnd = lnactive
  * vfp is active
ELSE
  * it isn't
ENDIF
With previous versions of VFP, you'd use the Foxtools Mainhwnd() function. For an SDI applicaton in 7.0 you'd use the active form's hwnd property. In VFP 6.0 and before you'd use _WFindTitl() and _Whtohwnd() passing the active form's caption. Both of these are in Foxtools.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform