The ability to control the Application window allows developers the flexibility to create effective and intelligent applications. There will be times when it is appropriate for your application to minimize the AutoCAD window, perhaps while your code is performing work in another application such as Excel. Additionally, you will often want to verify the state of the AutoCAD window before performing such tasks as prompting for input from the user.
Using methods and properties found on the Application object, you can change the position, size, and visibility of the Application window. You can also use the WindowState property to minimize, maximize, and check the current state of the Application window.
This example uses the WindowTop, WindowLeft, Width, and Height properties to position the AutoCAD Application window in the upper-left corner of the screen and size it to 400 pixels wide by 400 pixels high.
ThisDrawing.Application.WindowTop = 0
ThisDrawing.Application.WindowLeft = 0
ThisDrawing.Application.width = 400
ThisDrawing.Application.height = 400
ThisDrawing.Application.WindowState = acMax
ThisDrawing.Application.WindowState = acMin
This example queries the state of the Application window and displays the state in a message box to the user.
Dim CurrWindowState As Integer
Dim msg As String
CurrWindowState = ThisDrawing.Application.WindowState
msg = Choose(CurrWindowState, "normal", _
MsgBox "The application window is " + msg
The following code uses the Visible property to make the AutoCAD application invisible to the end user.
ThisDrawing.Application.Visible = False