Microsoft KB Archive/95934

From BetaArchive Wiki
Knowledge Base


ACC: How to Position Microsoft Access on the Screen

Article ID: 95934

Article Last Modified on 5/9/2003



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition



This article was previously published under Q95934

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:

148856 ACC: How to Position Microsoft Access on the Screen (95/97)



Additional query words: resize size

Keywords: kbhowto kbprogramming KB95934