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的文档/视程序中标题栏上的文档名。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值