CWindow::CenterWindow
Centraliza a janela em relação a uma determinada janela.
BOOL CenterWindow(
HWND hWndCenter = NULL
) throw();
Parâmetros
- hWndCenter
[in] O identificador para a janela em relação à qual centralizar.Se esse parâmetro for NULO (o valor padrão), o método será conjunto hWndCenter a janela de pai da janela se for uma janela filho. Caso contrário, ele definirá hWndCenter a janela do proprietário da janela.
Valor de retorno
TRUE se a janela estiver centralizado com êxito; caso contrário, FALSE.
Exemplo
//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
Cabeçalho: atlwin.h