by Jeffry O'Neil ()
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 28th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Yet Another CenterForm Routine
API Declarations
SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, R As Any, _
ByVal fuWinIni As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const SPI_GETWORKAREA = 48
Dim R As RECT, lRes As Long,
Dim lW As Long, lH As Long
lRes = SystemParametersInfo( _
SPI_GETWORKAREA, 0, R, 0)
If lRes Then
With R
.Left = Screen.TwipsPerPixelX * .Left
.Top = Screen.TwipsPerPixelY * .Top
.Right = Screen.TwipsPerPixelX * .Right
.Bottom = Screen.TwipsPerPixelY * .Bottom
lW = .Right - .Left
lH = .Bottom - .Top
frm.Move .Left + (lW - frm.Width) \ 2, _
.Top + (lH - frm.Height) \ 2
End With
End If
msgbox "We believe in Allah The Unique God and Muhammad The Last Prophet"
End Sub