ActiveWindow

Description:

baActiveWindow returns the handle of the currently active window.

Platforms:

Windows and Macintosh

Usage:

Result = baActiveWindow( )

Arguments:

None.

Returns:

Integer.
Returns the handle of the active window.

Examples:

Director:
WinHandle = baActiveWindow( )

Authorware:
WinHandle := baActiveWindow( )
 

Notes:

On Windows, under some conditions, this function can return 0. This would typically happen during the time an application starts up - the app may have control, but not yet opened its main window. Do not use a loop such as this:

wnd = 0
baRunProgram( "other.exe" , "normal" , false )
repeat while wnd <> baWinHandle()
   wnd = baActiveWindow() -- ActiveWindow could return 0
end repeat

In the case above, it is possible that wnd will equal 0, not the window handle of the new application. A better way to achieve this is to use the baNextActiveWindow function.
 

See also:

baNextActiveWindow
baWaitForWindow