Help Center

CWhsExec.AppActivatemethod

Activates an application window.

Windowsmethoddocumented

Syntax

FUNCTION AppActivate (BYREF wszTitle AS WSTRING, BYVAL bWait AS BOOLEAN = FALSE) AS BOOLEAN
FUNCTION AppActivate (BYREF processID AS LONG, BYVAL bWait AS BOOLEAN = FALSE) AS BOOLEAN

Parameters

NameDescription
wszTitleSpecifies which application to activate. This can be a string containing the title of the application (as it appears in the title bar) or the application's Process ID.
processIDSpecifies which application to activate. This can be a string containing the title of the application (as it appears in the title bar) or the application's Process ID.
bWaitBoolean. TRUE or FALSE.

Description

Activates an application window.

Remarks

The AppActivate method returns a Boolean value that identifies whether the procedure call is successful. This method changes the focus to the named application or window, but it does not affect whether it is maximized or minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window).

In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the application named by title exists, one instance is arbitrarily activated.

Reference

  • Defined in AfxNova/AfxWsh.inc:422
  • Documented in Windows/Windows Script/Windows Shell.md
  • Topic: Windows Shell