# WinProcesses

Import: `import com.install4j.api.windows.WinProcesses;`

```java
public class WinProcesses
```

Collection of static methods to check for running processes on Windows and terminate them.

| Type | Kind | Description |
|---|---|---|
## Nested types

| [WinProcesses.Info](WinProcesses.Info.md) | class | Class that holds information about running Windows processes. |

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getRunningProcesses()`](#getrunningprocesses) | `Info[]` | Get a list of all running processes the installer can see. |
| [`areInstalledLaunchersRunning()`](#areinstalledlaunchersrunning) | `boolean` | Determine if any of the installed launchers are currently running. |
| [`getWindowTitle(int)`](#getwindowtitle-int) | `String` | Get the title of one of the visible top-level windows of this process. |
| [`terminateProcesses(int[])`](#terminateprocesses-int) | `boolean` | Terminates the processes with the given ids forcefully. |
| [`closeProcesses(int[], int)`](#closeprocesses-int-int) | `boolean` | Tries to close the processes with the given ids by sending a WM_CLOSE message to all visible top-level windows. |

### getRunningProcesses()

```java
public static Info[] getRunningProcesses()
```

Get a list of all running processes the installer can see.


**Returns:** info objects with module name and process id.

### areInstalledLaunchersRunning()

```java
public static boolean areInstalledLaunchersRunning()
```

Determine if any of the installed launchers are currently running. All launchers in the currently set installation directory
are checked. The "Install Files" action performs this check by default and warns the user that processes are running.
With this method, you can check for this condition earlier in your installer.


**Returns:** `true` or `false`.

### getWindowTitle(int)

```java
public static String getWindowTitle(int processId)
```

Get the title of one of the visible top-level windows of this process.


**Parameters:**

- `processId` — the process id

**Returns:** the title

### terminateProcesses(int[])

```java
public static boolean terminateProcesses(int[] processIds)
```

Terminates the processes with the given ids forcefully.


**Parameters:**

- `processIds` — the processes to terminate

**Returns:** `true` if all processes have been terminated.

### closeProcesses(int[], int)

```java
public static boolean closeProcesses(int[] processIds, int timeout)
```

Tries to close the processes with the given ids by sending a WM_CLOSE message to all visible top-level windows.


**Parameters:**

- `processIds` — the processes to terminate
- `timeout` — the maximum time to wait for the processes to terminate after the message has been sent in milliseconds

**Returns:** `true` if all processes have been terminated.

## Constructors

| Signature | Description |
|---|---|
| [`WinProcesses()`](#winprocesses) |  |

### WinProcesses()

```java
public WinProcesses()
```

