Centers a window either in a specific window, it's parent window or on the desktop.

CenterWindowEx(nHwnd, nCenterInHwnd)

Parameters

nHwnd

A handle to the window which should be centered.

nCenterInHwnd (optional)

A handle to the window in which to center the window.
If you omit nCenterinHwnd the window is centered in it's parent window, if does not have a parent window it's centered on the desktop.

Return Value

Always .T.

See Also

Reference

AWindowProps
AWindows
AWindowsEx
GetWindowRectEx
GetWindowTextEx

Used WinApi functions

SetWindowPos
GetWindowRect
GetParent
GetSystemMetrics with parameter SM_CMONITORS
SystemParametersInfo with parameter SPI_GETWORKAREA
MonitorFromWindow