AppActivate (statement)

Syntax

AppActivate name$ | taskID

Description

Activates an application given its name or task ID.

Comments

The AppActivate statement takes the following parameters:

 

Parameter

Description

 

Name$

String containing the name of the application to be activated.

 

TaskID

Number specifying the task ID of the application to be activated. Acceptable task IDs are returned by the Shell function

 

When activating applications using the task ID, it is important to declare the variable used to hold the task ID as a Variant. The type of the ID depends on the platform on which The Basic Control Engine script is running.

Example 1

This example activates Program Manager.

Sub Main()

 AppActivate "Program Manager"

End Sub

Example 2

This example runs another application, activates it, and maximizes it.

Sub Main()

  Dim id as variant
  id = Shell("notepad.exe")      'Run Notepad minimized.
  AppActivate id            'Now activate Notepad.
  AppMaximize
End Sub

See Also

Shell (function); SendKeys (statement); WinActivate (statement).

Notes

The name$ parameter is the exact string appearing in the title bar of the named application's main window. If no application is found whose title exactly matches name$, then a second search is performed for applications whose title string begins with name$. If more than one application is found that matches name$, then the first application encountered is used.

Minimized applications are not restored before activation. Thus, activating a minimized DOS application will not restore it; rather, it will highlight its icon.

A runtime error results if the window being activated is not enabled, as is the case if that application is currently displaying a modal dialog box.

More information

A