Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maximizing access aplication from VB

Status
Not open for further replies.

Zeroanarchy

Technical User
Jun 11, 2001
630
0
0
AU
I have seen this recently but can not find the thread, what I am trying to do is open access from VB and maximize the application window and keep the form at its current size, I know that the thread is fairly recent.

All help greatly apreatiated.



Zero Anarchy
 
Create a module:

Option Compare Database
Option Explicit

'
Type Rect
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal _
nCmdShow As Long) As Long
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
Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect _
As Rect) As Long

Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNORMAL = 1

Sub MaximizeRestoredForm(F As Form)
Dim MDIRect As Rect
' If the form is maximized, restore it.
If IsZoomed(F.hWnd) <> 0 Then
ShowWindow F.hWnd, SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient area.
'This is the line which is different
GetClientRect GetParent(F.hWnd), MDIRect
' Move the form to the upper left corner of the MDIClient
' window (0,0) and size it to the same size as the
' MDIClient window.
MoveWindow F.hWnd, 0, 0, MDIRect.x2 - MDIRect.x1, MDIRect.y2 - MDIRect.y1, True
End Sub
'


In a form :

Private Sub Form_Load()
MaximizeRestoredForm Me
End Sub
 
If anyone comes across a procedure which is small can you let me know I saw somthing recently that was similar to;
App(maximize) or maybe a bit bigger than this would appreatiate any help, the above procedure changes the form size to 1*1*1*1 not really much use for what I am trying to do.
ZanfirMarin thanks for your time, greatly apreatiated.

Thanks

Zero Anarchy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top