<div class="meta" robots="noindex">

</div>

Class

# MDIWindow

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r3. Please use `desktopmdiwindow</api/user_interface/desktop/desktopmdiwindow>` as a replacement.

</div>

## Description

Used to configure the MDI window on Multiple Document Interface applications. Specify the Multiple Document Interface option in the Properties pane for the `App</api/language/app>` class.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                             | Type                               | Read-Only | Shared |
|----------------------------------|------------------------------------|-----------|--------|
| `Handle<mdiwindow.handle>`       | `Integer</api/data_types/integer>` | ✓         |        |
| `Height<mdiwindow.height>`       | `Integer</api/data_types/integer>` |           |        |
| `Left<mdiwindow.left>`           | `Integer</api/data_types/integer>` |           |        |
| `MaxHeight<mdiwindow.maxheight>` | `Integer</api/data_types/integer>` |           |        |
| `MaxWidth<mdiwindow.maxwidth>`   | `Integer</api/data_types/integer>` |           |        |
| `MinHeight<mdiwindow.minheight>` | `Integer</api/data_types/integer>` |           |        |
| `MinWidth<mdiwindow.minwidth>`   | `Integer</api/data_types/integer>` |           |        |
| `Title<mdiwindow.title>`         | `String</api/data_types/string>`   |           |        |
| `Top<mdiwindow.top>`             | `Integer</api/data_types/integer>` |           |        |
| `Visible<mdiwindow.visible>`     | `Boolean</api/data_types/boolean>` |           |        |
| `Width<mdiwindow.width>`         | `Integer</api/data_types/integer>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                | Parameters | Returns | Shared |
|-------------------------------------|------------|---------|--------|
| `Maximize<mdiwindow.maximize>`      |            |         |        |
| `Minimize<mdiwindow.minimize>`      |            |         |        |
| `Restore<mdiwindow.restore_method>` |            |         |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                               | Parameters | Returns |
|------------------------------------|------------|---------|
| `Moved<mdiwindow.moved>`           |            |         |
| `Open<mdiwindow.open>`             |            |         |
| `Resized<mdiwindow.resized>`       |            |         |
| `Restore<mdiwindow.restore_event>` |            |         |

## Property descriptions

<div id="mdiwindow.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Handle

**Handle** As `Integer</api/data_types/integer>`

Returns a handle to the MDI window. Any visible Win32 control should have a handle.

This property is read-only.

<div id="mdiwindow.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Height

**Height** As `Integer</api/data_types/integer>`

The height of the MDI window.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Left

**Left** As `Integer</api/data_types/integer>`

The distance (in pixels) between the left edge of the screen and the left edge of the MDI window.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.maxheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.MaxHeight

**MaxHeight** As `Integer</api/data_types/integer>`

The maximum height to which the MDI window can be resized.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.maxwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.MaxWidth

**MaxWidth** As `Integer</api/data_types/integer>`

The maximum width to which the MDI window can be resized.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.minheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.MinHeight

**MinHeight** As `Integer</api/data_types/integer>`

The minimum height to which the MDI window can be resized.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.minwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.MinWidth

**MinWidth** As `Integer</api/data_types/integer>`

The minimum width to which the MDI window can be resized.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Title

**Title** As `String</api/data_types/string>`

The MDI window title.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Top

**Top** As `Integer</api/data_types/integer>`

The distance (in pixels) between the top edge of the screen and the top edge of the MDI window.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Visible

**Visible** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the MDI window will be visible when it is opened.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

<div id="mdiwindow.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Width

**Width** As `Integer</api/data_types/integer>`

The width of the MDI window.

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
app.MDIWindow.Height=300
app.MDIWindow.Width=450
app.MDIWindow.Left=15
app.MDIWindow.Top=10
app.MDIWindow.Title="MDIWindow Title"
app.MDIWindow.MinWidth=250
app.MDIWindow.MinHeight=100
app.MDIWindow.MaxHeight=400
app.MDIWindow.MaxWidth=600

app.MDIWindow.Visible=True
```

## Method descriptions

<div id="mdiwindow.maximize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Maximize

**Maximize**

Maximizes the MDI window.

This example maximizes the MDI window.

``` xojo
app.MDIWindow.Maximize
```

<div id="mdiwindow.minimize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Minimize

**Minimize**

Minimizes the MDI window.

This example minimizes the MDI window.

``` xojo
app.MDIWindow.Minimize
```

<div id="mdiwindow.restore_method">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Restore

**Restore**

Restores the MDI window.

## Event descriptions

<div id="mdiwindow.moved">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Moved

**Moved**

Occurs when the MDI window moves.

<div id="mdiwindow.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Open

**Open**

Occurs when the MDI window is created.

<div id="mdiwindow.resized">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Resized

**Resized**

Occurs when the MDI window resizes.

<div id="mdiwindow.restore_event">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MDIWindow.Restore

**Restore**

Occurs when the MDI window is restored to its former size.

## Notes

You have the option of using the Multiple Document Interface (MDI) for the Windows build of your application. If you select this option, all of your application's windows will be enclosed in a "parent" window called the MDI window. If you don't select the MDI interface, then your application will be a Single Document Interface (SDI) application and your application's windows will be directly on the desktop (since there is no MDI window). This class allows you to set certain properties and behaviors of the MDI window.

You can set the <span class="title-ref">MDIWindow</span> property of the `App</api/user_interface/desktop/desktopapplication>` class to a new instance of an <span class="title-ref">MDIWindow</span> subclass. Use this technique to implement the events for an <span class="title-ref">MDIWindow</span>.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Getting the handle of a child window

There are two handles that a `Declare</api/language/declare>` writer may need when it comes to MDIWindows. The Handle property returns the frame window's handle. If you want the MDICLIENT handle for doing things like cascading child windows, then you need to get the child window based on the Handle with a code snippet like this:

``` xojo
Module MDIWindowExtensions
Private Var mClientHandle As Integer

Function MDIClientHandle(Extends w As MDIWindow) As Integer
  ' There's two different handles used for an MDI window.  The frame
  ' handle (which is MDIWindow.Handle), and the client handle.  This
  ' gets the client handle, which is used for things like tiling or cascading
  ' child windows.
  If mClientHandle <> 0 Then Return mClientHandle
  #If TargetWindows
    Declare Sub EnumChildWindows Lib "User32" ( parent As Integer, _
      proc As Ptr, lParam As Integer )
    mClientHandle = 0
    ' Do the enumeration
    EnumChildWindows(w.Handle, AddressOf enumChildProc, 0)
    ' Return the client's handle
    Return mClientHandle
  #EndIf
End Function

Function EnumChildProc(hwnd As Integer, lParam As Integer) As Boolean
  #If TargetWindows Then
    ' We need to figure out what class this window belongs to
    Soft Declare Function GetClassNameW Lib "User32" (hwnd As Integer,_
      name As Ptr, count As Integer) As Integer
    Soft Declare Function GetClassNameA Lib "User32" (hwnd As Integer, _
      name As Ptr, count As Integer) As Integer
    Var classNamePtr As New MemoryBlock(256)
    Var className As String
    If System.IsFunctionAvailable("GetClassNameW", "User32") Then
      Var cnt As Integer = GetClassNameW(hwnd, classNamePtr, classNamePtr.Size)
      className = classNamePtr.WString(0)
    Else
      Var cnt As Integer = GetClassNameA(hwnd, classNamePtr, classNamePtr.Size)
      className = classNamePtr.CString(0)
    End If
    ' If the name is MDICLIENT, then we're done
    If className = "MDICLIENT" Then
      mClientHandle = hwnd
      Return False
    End If
    Return True
  #EndIf
End Function
End Module
```

## Sample code

This example sets several properties of the <span class="title-ref">MDIWindow</span>. It is in the Open event of the app.

``` xojo
App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinWidth = 250
App.MDIWindow.MinHeight = 100
App.MDIWindow.MaxHeight = 400
App.MDIWindow.MaxWidth = 600
App.MDIWindow.Visible = True
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `DesktopApplication</api/user_interface/desktop/desktopapplication>` class; `App</api/language/app>` object.
