#Include once "window9.bi"

Function CenterWindow (ByVal hWnd As HWND) As Byte Export
  Dim wRect As RECT
  GetWindowRect(hWnd,@wRect)
  wRect.right   = wRect.right-wRect.left
  wRect.bottom  = wRect.bottom-wRect.top
  MoveWindow(hWnd,(GetSystemMetrics(0) Shr 1) - (wRect.right Shr 1),_
                  (GetSystemMetrics(1) Shr 1) - (wRect.bottom Shr 1),_
                  wRect.right, wRect.bottom, 1)
  Return 1
End Function
