Removing Untitled from MFC Window

CoderSource.net
Removing Untitled from MFC Window
Rating:

Date: 5/1/2004 12:00:00 AM

   The CFrameWnd class calls a lot of functions before instantiating a window. One of those functions PreCreateWindow, determines the styles of the Window. The styles are constant values viz., WS_MAXIMIZE, WS_MINIMIZE etc., 

   All of them are added with an OR operator and passed as a parameter to the PreCreateWindow. The PreCreateWindow takes in a parameter of type CREATESTRUCT structure. This structure has host of other members which contains data about other properties of the window.

   If the default styles loaded are changed and the style FWS_ADDTOTITLE is not added to the default style for CREATESTRUCT.style value, the "Untitled" will not be shown as the title of the window.

   The sample code is,

     BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
     {
          if( !CFrameWnd::PreCreateWindow(cs) )
              return FALSE;
          // TODO: Modify the Window class or styles here by modifying
          // the CREATESTRUCT cs
          cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU |  WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;

          return TRUE;
       }

You Can Rate this Article, if you are Logged In      
 

More Links from CoderSource.net:

 
Refer to a Friend:

Your Details:

Name:     e-mail:

Friend Details:

Name:    e-mail:    


MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Add to Google
Add to My Yahoo!
Welcome to Codersource.Net Login | Register | Faq  

SEARCH
Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us