This example for Windows returns the window handle for Visual FoxPro or izero if you switch to another Windows application. When the WAIT window is displayed, you have 5 seconds to press ALT+TAB
to switch to a different Windows application, or you can leave Visual FoxPro as the active application.
CLEAR
DECLARE INTEGER GetActiveWindow IN win32api
WAIT WINDOW "You can switch to another application now" TIMEOUT 5
? GetActiveWindow( )