CWindow::CenterWindow
Centra la ventana en una ventana especificada.
BOOL CenterWindow(
HWND hWndCenter = NULL
) throw();
Parámetros
- hWndCenter
[in] El identificador de la ventana en la que el centro.Si este parámetro es NULL (valor predeterminado), el método establecerá hWndCenter a la ventana principal de la ventana si es una ventana secundaria.Si no, establecerá hWndCenter a la ventana propietaria de la ventana.
Valor devuelto
TRUE si la ventana se centra correctamente; si no, FALSO.
Ejemplo
//The following example attaches various HWNDs to the CWindow objects
//and calls CWindow::CenterWindow() for each of them
CWindow childWindow, popupWindow, overlappedWindow;
childWindow.Attach(hWndChild); //a window created with WS_CHILD style
childWindow.CenterWindow(); //This will center the child
//window against its Parent window
popupWindow.Attach(hWndPopup); //a window created with WS_POPUP style
popupWindow.CenterWindow(); //This will center the popup window
//against its Owner window
overlappedWindow.Attach(hWndOverlapped); //a window created with
//WS_OVERLAPPED style
overlappedWindow.CenterWindow(::GetDesktopWindow()); //This will center
//the overlapped window against the DeskTop window
Requisitos
encabezado: atlwin.h