Microsoft KB Archive/95934

= 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:

 Open or create a new module in Microsoft Access.  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 &quot;user&quot; (ByVal lpClassName As Any,_                         ByVal lpCaption As Any) Declare Sub SetWindowPos Lib &quot;User&quot; (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.   Include the following function:

     Function SizeAccess Dim cX%, cY%, cHeight%, cWidth%, h%        'Get handle to Microsoft Access. h% = FindWindow(&quot;Omain&quot;, 0&)

cX% = 0 cY% = 0 cWidth% = 640 cHeight% = 480

'Position Microsoft Access. SetWindowPos h%, HWND_TOP, cX%, cY%, cWidth%, cHeight%,_ SWP_NOZORDER

End Function 

