Click to See Complete Forum and Search --> : Re: Centering a view?


Ramon Saenz-Badillos
March 28th, 1999, 09:01 PM
As Raj Kapoor says you can use CenterWindow() to center the dialog box in relation to a window. Call the function in

your dialogs box OnInitDialog

BOOL CyourdlgLL OnInitDialog() {

CDialog::OnInitDialog();

//get the active frame window

CWnd* pActiveFrame= //yourGetActiveFrame

SSERT_VALID( pActiveFrame);

CenterWindow(pActiveFrame);

return true;

To center the Dialog box in the desktop window call

CenterWindow(CWnd::GetDesktopWindow());


good luck