size & position of window

  • Thread starter Thread starter bg
  • Start date Start date
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!
 
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
 
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
 
The SetWindowPos function requires that the params be expressed as
pixels not TWIPS. There are several samples on my site that show how to
use this API.
The OP's request is much more involved then simply trying to set one
window to stay on top. The methods to force an application window to
stay and remain on top vary with the different releases of Windows. It's
a complex issue.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top