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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Sizing on Open

Status
Not open for further replies.

pmessana

Programmer
Jan 24, 2003
19
0
0
US
Does anyone know how to control the size of Access when it opens. When I say the size of access, I am talking about the size of the program, not the form that I have that opens up on open. I want to size the application since my form is small and I don't really want it to take over the full screen by opening in Maximize.

Not a highly important aspect of my program but if someone knows if it is possible that would be great.

Peter
 
You'll need to use the API but it's fairly straight-forward.

Make sure your startup child form is positioned in the upper left portion of the MDI window and call the ResizeAppWindow procedure in its Form_Load() event.


Code:
'@ API functions

Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long



Sub ResizeAppWindow()

  Dim lngReturn As Long
  Dim hWnd As Long
  
  ' get app's window handle
  hWnd = Application.hWndAccessApp
  
  ' move / resize app window. You could replace these hard-coded
  ' dimensions with dimensions retrieved from your child form.
  lngReturn = SetWindowPos(hWnd, 0, 100, 40, 600, 400, 0)
  
  ' normalize window
  lngReturn = ShowWindow(hWnd, 1)
  
End Sub
VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top