Activating a window in another application

activate_app()

Activate a window in another application


SYNTAX

activate_app(window_class, window_title [, option] )

Activates a top-level window in another application and brings it to the foreground. The application must already be running; this function does not start an application.

window_class

The class name of the window to be activated. A class name can be assigned to a Sculptor window by means of the Window class clause. The Spy tool provided with Microsoft C can be used to determine the class name of a window. This argument is mandatory.

window_title

The title of the window to be activated. This argument can be used to distinguish between different windows in the same class. The argument can be set to NULL, in which case the first window found in the specified class is activated. If NULL is not specified, the exact text of the window title is required.

option

This optional argument can be used to specify the window’s size and position, and whether or not it is activated, minimised or maximised. The valid options are defined as Activation options in <sculptor.h>. The default is AA_RESTORE (activate and show in previous size and position.)

If the chosen option activates the window, the window is brought to the foreground if possible. Note that Windows 98 and 2000 allow this only of one if the following is true:

1

The process is the foreground process.

2

The process was started by the foreground process.

3

The process received the last input event.

4

There is no foreground process.

5

The foreground process is being debugged.

6

The foreground is not locked.

WARNING: some programs change their window title dynamically.

The function returns zero if successful; otherwise non-zero.


EXAMPLE

activate_app("WordPadClass", NULL, AA_SHOWMAXIMIZED)