Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resize the Access window - not the forms

528 views
Skip to first unread message

Adam Cogan

unread,
Jan 7, 2000, 3:00:00 AM1/7/00
to
I have developed an Access database with forms set to 800x600 screen
resolution.

I don't want the resizing as I don't want to incur all the extra code.

However, if they have the resolution set above this (1024x768) the forms
only take up 800x600 in the top left hand corner. I don't mind this (and do
not want to resize them), but the Access window is maximized to 1024x768
which looks a little ordinary. Is there any way to resize the Access window
itself?

Cheers Adam
www.ssw.com.au
--------------------------------------------------------
Check out these HOT ACCESS UTILITIES....
* SSW Data PRO! (97 and 2000) www.ssw.com.au/ssw/DataPRO - Version Control
for your data.mdb
* SSW Data PRO! Renovator (97 and 2000)
ww.ssw.com.au/ssw/DataPRORenovator - Compare the differences between two
data.mdb's
* SSW Upsize PRO! (97 and 2000)
http://www.ssw.com.au/SSW/Download/default.asp - Don't UPSIZE to SQL Server
without it
--------------------------------------------------------

Terry Chapman

unread,
Jan 8, 2000, 3:00:00 AM1/8/00
to
Hi Adam,

Try the Windows API MoveWindow function

This will resize and move the Access parent window to where you want.

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

Function GetAccessHwnd() As Integer
' Comments : Returns the handle to the Access window
' Parameters: none
' Returns : integer window handle
'
Dim intHWnd As Integer
Dim strClassName As String
Dim intCounter As Integer

intHWnd = GetActiveWindow()

Do
strClassName = Space$(255)
intCounter = GetClassName(intHWnd, strClassName, Len(strClassName))
strClassName = Left$(strClassName, intCounter)

' OMain is the name of the Access window
If strClassName = "OMain" Then
Exit Do
Else
intHWnd = GetParent(intHWnd)
If intHWnd = 0 Then
Exit Do
End If
End If
Loop

GetAccessHwnd = intHWnd

End Function

Then make a call to the API function from VBA:

?MoveWindow(GetAccessHwnd, 100, 50, 800, 600, -1)

The parameters are:
1. The Access Parent window handle
2. Left
3. Top
4 Width
5 Height
6 Repaint

You'll probably want to fiddle around with the parameters.

HTH

Terry


"Adam Cogan" <adam...@ssw.com.au> wrote in message
news:ucx$20NW$GA....@cppssbbsa02.microsoft.com...

Stephen Lebans

unread,
Jan 8, 2000, 3:00:00 AM1/8/00
to
Terry I do not think you tried the code you posted or you would noticed
there is no way it would work. You are missing declarations for several
functions in the code and you have used variables declared as Integer
that should be Long. Finally you do not need all of the Class reference
code to dig out the Access Application hWnd. It is available directly as
a property of the Application object, Application.hWndAccessApp

Put this Declaration in the Forms General Declaration area.

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

' Here's the code to MoveSize the
' Access Main window behind a Command button
Private Sub CmdSizeWin_Click()
lngret = MoveWindow(Application.hWndAccessApp, 10, 10, 800, 600, -1)
End Sub

HTH

--
Stephen Lebans
maca...@nbnet.nb.ca
http://www.lebans.com
Free Access Code, Tips and Tricks

Terry Chapman wrote...
> Hi Adam,
SNIP

PDD

unread,
Jan 9, 2000, 3:00:00 AM1/9/00
to
In article <ucx$20NW$GA....@cppssbbsa02.microsoft.com>,

"Adam Cogan" <adam...@ssw.com.au> wrote:
> I have developed an Access database with forms set to 800x600 screen
> resolution.
>
> I don't want the resizing as I don't want to incur all the extra code.
>
> However, if they have the resolution set above this (1024x768) the
forms
> only take up 800x600 in the top left hand corner. I don't mind this
(and do
> not want to resize them), but the Access window is maximized to
1024x768
> which looks a little ordinary. Is there any way to resize the Access
window
> itself?

Yes. I have a freeware database available for download from my site
that has examples of resizing the Access window, the form window, and
more. It's called "Window Manipulation Examples", and you can download
it here:

http://www.peterssoftware.com

Thanks,

--
Peter De Baets

http://www.thepaintedid.com - The Painted iD
http://www.peterssoftware.com - Peter's Software - MS Access Tools


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages