Centering an Application Frame Window to desktop
· One min read
To center Application's Frame Window call CenterWindow() in MainFrame's OnCreate() function.
See the code snippet below
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//////////////////////////////////////////////////////////
// Center Application Frame Window //
/////////////////////////////////////////////////////////
CWnd* pWnd = GetDesktopWindow();
CenterWindow(pWnd);
//////////////////////////////////////////////////////////
return 0;
}