Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resize the MDI window

Posted on 1998-12-21
4
Medium Priority
?
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Sendoh earned 600 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

670 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