WindowState Property (ActiveX)

Specifies the state of the application or document window.

Supported platforms: Windows only

Signature

VBA:

object.WindowState
object

Type: Application, Document

The object this property applies to.

Property Value

Read-only: No

Type: acWindowState enum

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WindowState()
    ' This example reads and displays the current window state of the AutoCAD application.

    Dim CurrentState As String
    
    ' Use the "WindowState" variable to determine the window state of AutoCAD
    Select Case WindowState
        Case acMin: CurrentState = "Minimized"
        Case acMax: CurrentState = "Maximized"
        Case acNorm: CurrentState = "Normal Size"
    End Select

    ' Display window state
    MsgBox "AutoCAD is now: " & CurrentState
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowState()
    ;; This example reads and displays the current window state of the AutoCAD application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Use the "WindowState" variable to determine the window state of AutoCAD
    (setq CurrentState (cond 
                           ((= (vla-get-WindowState acadObj) acMin) "Minimized")
                           ((= (vla-get-WindowState acadObj) acMax) "Maximized")
                           ((= (vla-get-WindowState acadObj) acNorm) "Normal Size")
                       ))

    ;; Display window state
    (alert (strcat "AutoCAD is now: " CurrentState))
)