WindowTop Property (ActiveX)

Specifies the top edge of the application window.

Supported platforms: Windows only

Signature

VBA:

object.WindowTop
object

Type: Application

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The top edge of the application window.

Remarks

The top edge of the application is determined by the distance from the top edge of the main application window to the top edge of the screen.

This distance will establish the Y coordinate of the upper-left corner of the application. Note that the origin (0, 0) is the top, left corner.

Examples

VBA:

Sub Example_WindowTop()
    ' This example finds the WindowTop (X coordinate) of the WindowTop of the
    ' AutoCAD window. It then changes that position to be 100 more
    ' than it currently is. Finally, it resets the window to the
    ' original value.
    
    ' Find the current value of the WindowTop property
    Dim currWindowTop As Integer
    currWindowTop = ThisDrawing.Application.WindowTop
    MsgBox "The current value of WindowTop is " & ThisDrawing.Application.WindowTop, , "WindowTop Example"
    
    ' Change the value of WindowTop
    ThisDrawing.Application.WindowTop = currWindowTop + 100
    MsgBox "The new value of WindowTop is " & ThisDrawing.Application.WindowTop, , "WindowTop Example"
    
    ' Reset the value of WindowTop
    ThisDrawing.Application.WindowTop = currWindowTop
    MsgBox "The value of WindowTop has been reset to " & ThisDrawing.Application.WindowTop, , "WindowTop Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowTop()
    ;; This example finds the WindowTop (X coordinate) of the WindowTop of the
    ;; AutoCAD window. It then changes that position to be 100 more
    ;; than it currently is. Finally, it resets the window to the
    ;; original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current value of the WindowTop property
    (setq currWindowTop (vla-get-WindowTop acadObj))
    (alert (strcat "The current value of WindowTop is " (itoa currWindowTop)))
    
    ;; Change the value of WindowTop
    (vla-put-WindowTop acadObj (+ currWindowTop 100))
    (alert (strcat "The new value of WindowTop is " (itoa (vla-get-WindowTop acadObj))))
    
    ;; Reset the value of WindowTop
    (vla-put-WindowTop acadObj currWindowTop)
    (alert (strcat "The value of WindowTop has been reset to " (itoa (vla-get-WindowTop acadObj))))
)