We help IT Professionals succeed at work.

Access Form WindowHeight, WindowWidth

Tom Knowlton
Tom Knowlton asked
I can see that the Form has properties for WindowHeight and WindowWidth, but what I need is WindowTop and WindowLeft.

What I want to do have a label on a form which at runtime will update with the TWIPS for the form (RIGHT, DOWN, WIDTH, HEIGHT).

This is different from function MoveSize, which allows you to move and resize the form.


Watch Question

Public Type MyXY
  MyLeft As Long
  MyTop As Long
  MyRight As Long
  MyBottom As Long
 End Type
Declare Function GetWindowRect Lib "user32.dll" _
(ByVal hWnd As Long, ByRef MyData As MyXY) As Boolean

Dim aaa As Boolean
Dim MyCoor As MyXY
aaa = GetWindowRect(Me.hWnd, MyCoor) - current active form

aaa = GetWindowRect(Forms![FormName].hWnd, MyCoor) - any load form

MyCoor.MyLeft - Left Cordinate X ,
MyCoor.MyTop - Top, e.t.c.