bucko, what you need to use the API?
Code:
Option Explicit
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
Private Sub Form_Load()
Dim NewX As Long
Dim NewY As Long
Dim NewW As Long
Dim NewH As Long
NewX = ScaleX((Screen.Width - Me.Width) \ 2, vbTwips, vbPixels)
NewY = ScaleY((Screen.Height - Me.Height) \ 2, vbTwips, vbPixels)
NewW = ScaleX(Me.Height, vbTwips, vbPixels)
NewH = ScaleY(Me.Height, vbTwips, vbPixels)
MoveWindow Me.hwnd, NewX, NewY, NewW, NewH, True
End Sub
or you can archieve this without the API
Code:
Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then
Me.Left = (Screen.Width - Me.Width) \ 2
Me.Top = (Screen.Height - Me.Height) \ 2
End If
End Sub