Solved

Resize the MDI window

Posted on 1998-12-21
4
219 Views
Last Modified: 2012-06-21
I am trying to find a way to use API calls (or something easier!) that will allow me to resize and possibly move the main window of Access while the app is running.  Any help?
0
Comment
Question by:dexweaver
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Sendoh earned 200 total points
ID: 1971745
Hi !

The code as follow :

Option Compare Database
Option Explicit

Public Const HWND_TOP = 0
Public Const SWP_SHOWWINDOW = &H40

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

Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
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

Function setSizeAccess() As Boolean
    Dim rc As RECT
   
    GetWindowRect Application.hWndAccessApp, rc
    MsgBox "left = " & rc.Left & Chr(13) & _
            "right = " & rc.Right & Chr(13) & _
            "top = " & rc.Top & Chr(13) & _
            "bottom = " & rc.Bottom & Chr(13)
    msgbox SetWindowPos(Application.hWndAccessApp, HWND_TOP, _
            rc.Left, rc.Top, (rc.Right - rc.Left)+100,
(rc.Bottom - rc.top) + 100, SWP_SHOWWINDOW)
End Function

0
 
LVL 5

Expert Comment

by:kulikuli
ID: 1971746
If I am correct you should flip the sides you are summing:
(rc.Right - rc.Left) should be (rc.left-rc.right)
(rc.Bottom - rc.top) should be (rc.top - rc.bottom)

Right?
0
 
LVL 1

Author Comment

by:dexweaver
ID: 1971747
It will take me till after the holidays to evaluate your answer, sendoh.  I appreciate your response!!
0
 
LVL 1

Author Comment

by:dexweaver
ID: 1971748
I lied.  I couldn't wait to evaluate it.  I'm like a kid in a candy store with that function!  10q very much.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now