eryar

Enjoy Learning C++

Removing the Document Name from the Title Bar

 

Removing the Document Name from the Title Bar

DriveTree doesn't use its document object at all. Its File menu doesn't include document-handling commands. And it doesn't display a document name in its title bar because it doesn't make sense to display a document name when the application doesn't support the loading and saving of documents. But because MFC automatically adds the document name to the title bar, you must take special steps to prevent MFC from inserting a document name.

You'll find the code responsible for removing the document name in the frame window class. CMainFrame::PreCreateWindow contains the statement

FWS_ADDTOTITLE is a special window style specific to MFC that's included in frame windows by default. Windows that have this style have document names added to their window titles; windows that lack this style don't. By stripping the FWS_ADDTOTITLE bit from the window style in PreCreateWindow, CMainFrame prevents the framework from modifying its window title. You can use this technique to remove the document name from the title bar of any document/view application.

 

在文档/视的MFC程序中,有时不想在标题栏中显示文档名,因此想办法来解决这个问题。

 

FWS_ADDTOTITLE是MFC默认包含的一个窗口样式。设置此样式的窗口会把文档名加到窗口的标题上去,未设置此样式就不会。可以函数:PreCreateWindow中将样式中FWS_ADDTOTITLE的位翻转下就可以把标题中的文档名去掉了。

 

你可使用此法来去掉任何MFC的文档/视程序中标题栏上的文档名。

阅读更多
个人分类: MFC
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭