DesktopDisplay.LastDisplayIndex

From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aDesktopDisplay.LastDisplayIndex

New in 2021r3

Supported for all project types and targets.

The index of the last display connected to the user's computer. Display 0 is the main display. This can be useful when you need to loop through the user's displays.

Example

This example finds the maximum screen depth of all displays connected to the user's computer:

Var maxDepth As Integer
For i As Integer = 0 To DesktopDisplay.LastDisplayIndex
Var currentDisplayDepth As Integer
currentDisplayDepth = DesktopDisplay.DisplayAt(i).ColorDepth
If currentDisplayDepth > maxDepth Then
maxDepth = currentDisplayDepth
End If
Next