ACC: How to Position Microsoft Access on the Screen

Last reviewed: June 8, 1997
Article ID: Q95934
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

To position Microsoft Access on the screen, you need to call the SetWindowPos() Windows API function. The article gives a brief demonstration of how to position Microsoft Access on the screen.

MORE INFORMATION

To position Microsoft Access on the screen, you will need to use the SetWindowPos() application programming interface (API) function included in the USER.EXE dynamic link library (DLL) included with Windows. Implement this function as follows:

  1. Open or create a new module in Microsoft Access.

  2. Within the Declarations section, add the following declares, constants, and comments.

    NOTE: In the following sample code, an underscore (_) is used as a line continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

          '====================================
          ' Global Declarations
          '====================================
          Option Compare Database
          Option Explicit
    

          Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,_
    
                              ByVal lpCaption As Any)
          Declare Sub SetWindowPos Lib "User" (ByVal hWnd%,_
                              ByVal hWndInsertAfter%, ByVal X%, ByVal Y%,_
                              ByVal cx%, ByVal cy%, ByVal wFlags%)
    
          'Inserts the window to precede the position window in the Z-Order.
          'This parameter must be a window handle or one of the following
          'constants.
    
          Global Const HWND_TOP = 0
    
          'Values for wFlags%.
    
          Global Const SWP_NOZORDER = &H4      'Ignores the hWndInsertAfter.
    
    

  3. Include the following function:

          Function SizeAccess ()
    
             Dim cX%, cY%, cHeight%, cWidth%, h%
             'Get handle to Microsoft Access.
             h% = FindWindow("Omain", 0&)
    
             cX% = 0
             cY% = 0
             cWidth% = 640
             cHeight% = 480
    
             'Position Microsoft Access.
             SetWindowPos h%, HWND_TOP, cX%, cY%, cWidth%, cHeight%,_
             SWP_NOZORDER
    
          End Function
    
    

REFERENCES

For an example of how to position Microsoft Access on the screen in Microsoft Access for Windows 95 version 7.0, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q148856
   TITLE:      ACC: How to Position Microsoft Access on the Screen (95/97)


Additional query words: resize size
Keywords : kbprg PgmApi
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 8, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.