R: Get handles of Windows in the MS Windows RGui

getWindowsHandles {utils} | R Documentation

## Get handles of Windows in the MS Windows RGui

### Description

This function gets the Windows handles of visible top level windows or windows within the R MDI frame (when using the `Rgui`).

### Usage

    getWindowsHandles(which = "R", pattern = "", minimized = FALSE)

### Arguments

`which` | A vector of strings "R" or "all" (possibly with repetitions). See the Details section.
`pattern` | A vector of patterns that the titles of the windows must match.
`minimized` | A logical vector indicating whether minimized windows should be considered.

### Details

This function will search for Windows handles, for passing to external GUIs or to the `arrangeWindows` function. Each of the arguments may be a vector of values. These will be treated as follows:

- The arguments will all be recycled to the same length.

- The corresponding elements of each argument will be applied in separate searches.

- The final result will be the union of the windows identified in each of the searches.

If an element of `which` is `"R"`, only windows belonging to the current R process will be returned. In MDI mode, those will be the child windows within the R GUI (`Rgui`) frame. In SDI mode, all windows belonging to the process will be included.

If the element is `"all"`, then top level windows will be returned.

The elements of `pattern` will be used to make a subset of windows whose title text matches (according to `grep`) the pattern.

If `minimized = FALSE`, minimized windows will be ignored.

### Value

A list of external pointers containing the window handles.

### Note

This is only available on Windows.

### Author(s)

Duncan Murdoch

### See Also

`arrangeWindows`, `getWindowsHandle` (singular).

### Examples

    if(.Platform$OS.type == "windows") withAutoprint({
      getWindowsHandles()
      getWindowsHandles("all")
    })

[Package utils version 4.0.5 Index]