NextActiveWindow

Description:

baNextActiveWindow returns the next window to become active.

Platforms:

Windows and Macintosh

Usage:

Result = baNextActiveWindow( TimeOut )

Arguments:

Integer.
TimeOut is the maximum amount of time to wait in ticks. A tick is equal to 1/60th of a second. If TimeOut is 0, the function will wait indefinitely.

Returns:

Integer.
Returns the handle of the next active window.
Returns 0 if the timeout occurs before another window becomes active.

Examples:

Director:
wnd = baNextActiveWindow( 300 ) -- waits for the next window to become active, for a maximum of 5 seconds

Authorware:
wnd := baNextActiveWindow( 600 )
 

Notes:

The next active window is defined as the next window that isn't the window of the Director/Authorware calling program, or a dialog box or a splash screen. It would be typically used after a baRunProgram or baOpenFile call to get the handle of the window the program opens, and is particularly useful for applications such as Netscape and Acrobat that open splash screens.

Here is an example of opening an Acrobat file in Director, and closing it when the user is finished with it.

if baOpenFile( "readme.pdf" , "normal" ) > 32 then -- open acrobat file
    wnd = baNextActiveWindow( 0 ) -- get handle of Acrobat window
    baWaitForWindow( baWinHandle() , "active" , 0 ) -- wait till the Director window is active i.e. Acrobat has been closed or user switched back to Director
    if baWindowExists( wnd ) then
        baCloseWindow( wnd ) -- close Acrobat
    end if
end if

 

See also:

baWaitTillActive
baWaitForWindow
baActiveWindow