Skip to main content

Center an MFC Dialog

· One min read

Use the CWnd::CenterWindow method to center the dialog. Write CenterWindow() method in the OnInitDialog() method.

BOOL CMyDialog::OnInitDialog() { 
CenterWindow();
return TRUE;
}