Brett Barabash
BBarabash at TappeConstruction.com
Thu Feb 27 12:12:00 CST 2003
Hi Rocky, There are various methods of accomplishing this. Personally, I prefer to use the API call method instead of MoveSize. By using a combination of GetWindowRect and MoveWindow, I have complete control of how the window is positioned. Here is an example: Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long Public Sub RepositionForm(frm As Form, ByVal X As Long, ByVal Y As Long) Dim lngRet As Long Dim typRect As RECT 'Get existing window dimensions lngRet = GetWindowRect(frm.hwnd, typRect) 'Move window to new location, preserving dimensions lngRet = MoveWindow(frm.hwnd, X, Y, typRect.Right - typRect.Left, typRect.Bottom - typRect.Top, 1) End Sub Now, in your Form_Load event, type: Private Sub Form_Load() RepositionForm Me, 10, 10 End Sub - The X and Y values are in Pixels, not twips. If you need a method of converting it, let me know. - If you need to center the form on the screen, you also need to get your desktop window dimensions. Again, let me know. Brett Barabash, MCP Tappe Construction, Co. Eagan, MN bbarabash at tappeconstruction.com (651) 256-6831 "The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows" - Frank Zappa -----Original Message----- From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] Sent: Thursday, February 27, 2003 11:52 AM To: AccessD at databaseadvisors.com Subject: [AccessD] Position pop up form on opening Dear List: How does one position a pop up form on opening? I tried Auto-Center but it's too high. I need to tell it just where to go. MTIA, Rocky Smolin Beach Access Software