Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3304074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:01:25+00:00 2026-05-17T21:01:25+00:00

Scenario: In an Access project a main form has to be positioned and rearranged

  • 0

Scenario: In an Access project a main form has to be positioned and rearranged depending on the size of the Access-Application window. This should be done using VBA.

As far as I know there is no way in Microsoft Access VBA to capture the Restore/Maximize-Event of the Access-Application window (I refer to the Access Window itself not any form inside this).

Is there a way to solve this issue using WIN32 API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:01:25+00:00Added an answer on May 17, 2026 at 9:01 pm

    I don’t know of any way to use the WIN32 API to capture the Restore/Maximize Event. The best workaround I can think of is to use the Win32 API in conjunction with the Timer event of a form that is always open (either the Main Menu or some hidden form) and periodically poll the main access window to determine whether it’s currently maximized.

    Enum WindowSize
        wsMax = 1
        wsMin
        wsRestore
    End Enum
    
    'Functions return 1 for true and 0 for false; multiply result by -1 to use as Boolean'
    Private Declare Function IsZoomed Lib "User32" (ByVal hWnd As Long) As Integer
    Private Declare Function IsIconic Lib "User32" (ByVal hWnd As Long) As Integer
    
    Function IsMaximized(hWnd As Long) As Boolean
        IsMaximized = IsZoomed(hWnd) * -1
    End Function
    
    Function IsMinimized(hWnd As Long) As Boolean
        IsMinimized = IsIconic(hWnd) * -1
    End Function
    
    Private Sub Form_Timer()
    Static PrevWinSize As WindowSize
    
        If IsMaximized(hWndAccessApp) Then
            If PrevWinSize <> wsMax Then
                'Window has been maximized since we last checked'
                MsgBox "Main Access window is maximized"
                PrevWinSize = wsMax
            End If
        ElseIf IsMinimized(hWndAccessApp) Then
            If PrevWinSize <> wsMin Then
                'Window has been minimized since we last checked'
                MsgBox "Main Access window is minimized"
                PrevWinSize = wsMin
            End If
        Else
            If PrevWinSize <> wsRestore Then
                'Window has been restored since we last checked'
                MsgBox "Main Access window is restored"
                PrevWinSize = wsRestore
            End If
        End If
    
    End Sub
    

    You’ll need to set an interval in the form’s TimerInterval property to control how frequently you need to poll the window size.

    EDIT: Obviously you’ll want to keep track of the main window’s previous state so that you don’t do any unnecessary processing. The code as posted reflects this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: I have a console application that needs to access a network share with
I have the following scenario. The client code only has access to FooHandler, not
Scenario: I am in the process of moving an application from access to C#
Consider this scenario. I have a small enterprise project dev environment. We use archiva
Our project has about 20 developers, but our application makes relatively light use of
SCENARIO I have to access a web service with a .NET client. The service
We have a scenario where some .NET code is attempting to access the current
I have a scenario where a user will have access to a one-time-url. When
I have a scenario that when I try to access a hash key using
I'm running into a scenario where at random times I am getting Access Denied

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.