size & position of window

B

bg

Trying to resize the entire Access window and set
the window to always stay on top. I do not want to
merely resize & lock individual form widows within Access.

Looking for a low, long profile along the bottom of the
screen so I can see other application windows behind.
Any suggestions? TIA!
 
B

Byron

Try the following:

Place the following function in the module of your
startup form:

Function SizeAccess(cX As Long, cY As Long, _
cHeight As Long, cWidth As Long)

Dim h As Long
'Get handle to Microsoft Access.
h = Application.hWndAccessApp

'Position Microsoft Access.
SetWindowPos h, HWND_TOP, cX, cY, cWidth, _
cHeight, SWP_NOZORDER

End Function

Then call it will the following code in the OnCurrent
event of your startup form:

Call SizeAccess(200, 30, 700, 650)

The peramaters are as follows:
The first two numbers represent the location of the
Access window in twips and the last two numbers represent
the size of the Access Window, again in twips.

HTH
Byron
 
B

Byron

Steven,

I am using this code in an application now, but seems
that I forgot to also include the following:

'====================================
' Global Declarations
'====================================

'NOTE: The following "Declare" statement is case
sensitive.

Declare Sub SetWindowPos Lib "User32" (ByVal hWnd&, _
ByVal hWndInsertAfter&, _
ByVal X&, ByVal Y&, ByVal cX&,
_
ByVal cY&, ByVal wFlags&)

'Moves MS Access window to top of Z-order.
Global Const HWND_TOP = 0

'Values for wFlags.
Global Const SWP_NOZORDER = &H4 'Ignores the
hWndInsertAfter.

This code must be in a module (not a form module). Then
the code should work.

Thanks for calling my attention to my mistake.

Byron
 
Top