Class

DesktopMDIWindow


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 class.

Methods

Name

Parameters

Returns

Shared

Maximize

Minimize

Restore

Events

Name

Parameters

Returns

Maximized

Minimized

Moved

Opening

Resized

Restore

Property descriptions


DesktopMDIWindow.Handle

Handle As Ptr

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

This property is read-only.


DesktopMDIWindow.Height

Height As Integer

The height of the MDI window.

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.Left

Left As 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 DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.MaximumHeight

MaximumHeight As Integer

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

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.MaximumWidth

MaximumWidth As Integer

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

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.MinimumHeight

MinimumHeight As Integer

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

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.MinimumWidth

MinimumWidth As Integer

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

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.Title

Title As String

The MDI window title.

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.Top

Top As 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 DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.Visible

Visible As Boolean

If True, the MDI window will be visible when it is opened.

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

DesktopMDIWindow.Width

Width As Integer

The width of the MDI window.

This example sets several properties of the DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

Method descriptions


DesktopMDIWindow.Maximize

Maximize

Maximizes the MDI window.

This example maximizes the MDI window.

App.MDIWindow.Maximize

DesktopMDIWindow.Minimize

Minimize

Minimizes the MDI window.

This example minimizes the MDI window.

App.MDIWindow.Minimize

DesktopMDIWindow.Restore

Restore

Restores the MDI window.

Event descriptions


DesktopMDIWindow.Maximized

Maximized

Occurs when the MDI window maximized.


DesktopMDIWindow.Minimized

Minimized

Occurs when the MDI window minimized.


DesktopMDIWindow.Moved

Moved

Occurs when the MDI window moves.


DesktopMDIWindow.Opening

Opening

Occurs when the MDI window is created.


DesktopMDIWindow.Resized

Resized

Occurs when the MDI window resizes.


DesktopMDIWindow.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 DesktopMDIWindow property of the App class to a new instance of an DesktopMDIWindow subclass. Use this technique to implement the events for an DesktopMDIWindow.


Getting the handle of a child window

There are two handles that a 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:

Module MDIWindowExtensions

  Private Var mClientHandle As Ptr

  Function MDIClientHandle(Extends w As DesktopMDIWindow) As Ptr
    ' There's two different handles used for an MDI window. The frame
    ' handle (which is DesktopMDIWindow.Handle), and the client handle. This
    ' gets the client handle, which is used for things like tiling or cascading
    ' child windows.

    If mClientHandle <> Nil Then Return mClientHandle

    #If TargetWindows

      Declare Sub EnumChildWindows Lib "User32" (parent As Ptr, _
        proc As Ptr, lParam As Integer)
      mClientHandle = Nil
      ' Do the enumeration
      EnumChildWindows(w.Handle, AddressOf enumChildProc, 0)
      ' Return the client's handle
      Return mClientHandle

    #Endif
  End Function

  Function EnumChildProc(hwnd As Ptr, 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 Ptr,_
        name As Ptr, count As Int32) As Int32
      Soft Declare Function GetClassNameA Lib "User32" (hwnd As Ptr, _
        name As Ptr, count As Int32) As Int32

      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 DesktopMDIWindow. It is in the Opening event of the App.

App.MDIWindow.Height = 300
App.MDIWindow.Width = 450
App.MDIWindow.Left = 15
App.MDIWindow.Top = 10
App.MDIWindow.Title = "MDIWindow Title"
App.MDIWindow.MinimumWidth = 250
App.MDIWindow.MinimumHeight = 100
App.MDIWindow.MaximumHeight = 400
App.MDIWindow.MaximumWidth = 600
App.MDIWindow.Visible = True

Compatibility

Project Types

Desktop

Operating Systems

All

See also

Object parent class; DesktopApplication class; App object.