Skip to main content

How do remove 'Untitled' in main window caption

· One min read

To remove 'Untitled' in main window caption

  1. Override the PreCreateWindow() function in CMainFrame class
  2. Modify the CREATESTRUCT style by adding the below code cs.style &= ~FWS_ADDTOTITLE ;

Code snippet:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;

////////////////////////////////////////////////////////////////////////////
// To remove 'Untitled' in main window caption //
////////////////////////////////////////////////////////////////////////////
cs.style &= ~FWS\_ADDTOTITLE ;
////////////////////////////////////////////////////////////////////////////

return TRUE;
}