Hi Reidar
The following procedure (with associated declarations) will size the Access
application window. It first restores it if it is maximized, then resizes
it. The second argument (height) is optional and if you don't provide it,
the procedure calculates the appropriate default 4:3 aspect ratio. For
example,
SizeAccessWindow 800
is equivalent to
SizeAccessWindow 800, 600
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
========== start code ===========
Private Declare Function IsZoomed Lib "user32" _
(ByVal hWnd As Long) _
As Long
Private Declare Function ShowWindow Lib "user32" _
(ByVal hWnd As Long, _
ByVal nCmdShow As Long) _
As Long
Private Const SW_SHOWNORMAL = 1
Private Declare Function MoveWindow Lib "user32" _
(ByVal hWnd As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal bRepaint As Long) _
As Long
Public Sub SizeAccessWindow(ByVal lPixelsX As Long, Optional ByVal lPixelsY
As Long)
Dim hWnd As Long
If lPixelsY = 0 Then lPixelsY = lPixelsX * 3 / 4
hWnd = Application.hWndAccessApp
If IsZoomed(hWnd) Then
ShowWindow hWnd, SW_SHOWNORMAL
End If
MoveWindow hWnd, 0, 0, lPixelsX, lPixelsY, True
End Sub
=========== end code ============