Get usable area of access window?

J

Jack Leach

Might anyone happen to know if it's possible to get the size (in any format)
of the *usable* part of the access window (I believe this is the referred to
as the Client?).

I'm trying to determine the maximum sized form I can fit in the Access
window without scrollbars. I've worked around this in the past by making the
main form large enough to overrun the access window but disabling scrollbars.
Now, though, I want to base other controls (subform) on the height of the
main form (I have a list of custom controls used for navigation in a top-down
format, and want to fit as many as possible based on the computer's screen
resolution).

So I can get the Screen, no biggie... but that leaves a buffer for the start
menu (which will vary depending on autohide or fixed), a buffer for the bar
at the top of the access window (the one with the control box... forget the
actual name of it), and a buffer for the one menubar that is fixed directly
below that.

I've done this using guesswork before, but would really like to get this
nailed down accurately.

I assume that the top bar (with the control buttons) and probably the menu
bar both have a *specific* value (be it in twips, pixels, or some other
convertable unit). If I remember correctly, the start menu is sizable, but
in a specified increment, so I'm hoping I can come up with a fixed number for
that as well.

Any ideas on where I might come up with this information? BTW...
DoCmd.Maximize is not an option. I've searched Dev's MVPS.org and
Lebans.com, but have not found the information I'm looking for. Web searches
have proven futile.

Thanks for any pointers.


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
J

Jack Leach

I found code for the Start Menu height:

http://www.xtremevbtalk.com/showthread.php?t=57614



Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long

Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, _
lpRect As RECT) As Long

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Sub Form_Load()

Dim lWnd As Long
Dim r As RECT

lWnd = FindWindow("Shell_traywnd", "")

GetWindowRect lWnd, r

MsgBox "Height = " & r.Bottom - r.Top

End Sub


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
J

Jack Leach

And finally, a description of all the constants to GetSystemMetrics, which
probably has exactly what I need without doing the calculations on mine own
(yay!)


http://www.xtremevbtalk.com/showthread.php?t=69272


If someone wants to reply anyway, I'll check this off as answered for anyone
else that may come across the tread in the future.

Sorry for clogging the board.
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
Might anyone happen to know if it's possible to get the size (in any
format)
of the *usable* part of the access window (I believe this is the referred
to
as the Client?).

I'm trying to determine the maximum sized form I can fit in the Access
window without scrollbars. I've worked around this in the past by making
the
main form large enough to overrun the access window but disabling
scrollbars.
Now, though, I want to base other controls (subform) on the height of the
main form (I have a list of custom controls used for navigation in a
top-down
format, and want to fit as many as possible based on the computer's screen
resolution).

So I can get the Screen, no biggie... but that leaves a buffer for the
start
menu (which will vary depending on autohide or fixed), a buffer for the
bar
at the top of the access window (the one with the control box... forget
the
actual name of it), and a buffer for the one menubar that is fixed
directly
below that.

I've done this using guesswork before, but would really like to get this
nailed down accurately.

I assume that the top bar (with the control buttons) and probably the menu
bar both have a *specific* value (be it in twips, pixels, or some other
convertable unit). If I remember correctly, the start menu is sizable,
but
in a specified increment, so I'm hoping I can come up with a fixed number
for
that as well.

Any ideas on where I might come up with this information? BTW...
DoCmd.Maximize is not an option. I've searched Dev's MVPS.org and
Lebans.com, but have not found the information I'm looking for. Web
searches
have proven futile.


Are you sure this (from mvps.org\access) isn't what you're looking for?

http://www.mvps.org/access/api/api0022.htm

It provides a function, written by Terry Kreft, to "maximize" a restored
form by sizing it to the client area of the application window.

I know it works for Access 97 - 2003; I don't know if it works for Access
2007, with its Nav Pane and all.
 
J

Jack Leach

Tricky tricky... I didn't open that one, thinking it was how to disable the
close button, rather than maximize without "maximizing".

:)

Thanks. Easier than the way I was heading. I've been trying to get the
size of the client area through GetSystemMetrics, which returns the same as
the the screen resolution. I see here that Mr. Kreft uses the GetClientRect
API to get the client area *inside* the parent of the form (Access window)
rather than the Client area that GetSystemMetrics gives (which is what the
Access window itself can fit into).

Thank you much Kind Sir.
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
Tricky tricky... I didn't open that one, thinking it was how to disable
the
close button, rather than maximize without "maximizing".


Yes, I think they should rename that one, or provide a separate link to the
same article with a more explanatory name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top