I did this like an hour ago Very ironic!
Here's what I've got:
The math is pretty simple... If you want to center a window, you first need the coordinates of the center of the screen, so you get the screen width and divide by 2 and the screen height and divide by 2... then in order to get the window's upper-left coordinates for ::SetWindowPos(), you need to subract half of the window's width from the screen center position, and subtract half of the window's height from the screen center position. You get the window's width and height with ::GetWindowRect() and then by subtracting its right side position from its left side for width, and bottom side position from its top side position for its height.
::SetWindowPos(hDlg, HWND_TOPMOST, (::GetSystemMetrics(SM_CXSCREEN)/2 - ((Rect.right - Rect.left)/2)),
(::GetSystemMetrics(SM_CYSCREEN)/2 - ((Rect.bottom - Rect.top)/2)),
(Rect.right - Rect.left), (Rect.bottom - Rect.top), SWP_SHOWWINDOW);
I've also learned that ::GetWindowRect() will retrieve a window's RECT even if the window is hidden (I guess from last known coordinates)... just a random little info