单文档修改里面的内容,关闭窗口如何去掉保存提示狂。

void_main_void 2016-08-21 08:13:04
单文档修改里面的内容,关闭窗口如何去掉保存提示狂。

这个红框框内容如何去掉。该删除哪里的代码?

...全文
230 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
schlafenhamster 2016-08-22
  • 打赏
  • 举报
回复
如 GetEditCtrl().SetSel(0,0); // GetEditCtrl().UnlockWindowUpdate(); GetEditCtrl().ShowWindow(SW_SHOW); // Otherwise you will be asked to save ... SetModify(FALSE);//ours // do not use : // GetEditCtrl().SetModify(FALSE); class CShowHexView : public CEditView 里 void SetModify(BOOL bModified) { m_bModified = bModified; }
void_main_void 2016-08-21
  • 打赏
  • 举报
回复
引用 3 楼 jennyvenus 的回复:
我都直接Kill掉自己。
可以了。。CMainFrame::OnClose() ExitProcess 就好了
void_main_void 2016-08-21
  • 打赏
  • 举报
回复
现在,就算想自己kill掉自己, 我在框架中直接 重写 OnClose 还是先弹出对话框。。你是重写哪里的哪个函数?我重写 CEditView 或者是框架 的OnClose 都没用。还是会弹出是否需要保存的对话框。
用户 昵称 2016-08-21
  • 打赏
  • 举报
回复
我都直接Kill掉自己。
void_main_void 2016-08-21
  • 打赏
  • 举报
回复
引用 1 楼 schlafenhamster 的回复:
PRB: Using CEdit SetModify/GetModify Returns Invalid Values Last reviewed: March 2, 1998 Article ID: Q155224 4.00 4.10 4.20 WINDOWS NT kbprg kbprb The information in this article applies to:
你好,这个没看明白啊。。我使用VS2013,在属性当中重写并没有看到有 OnChange 的重写,在消息里没有 OnChange 或者 OnEditChange 也没有。
schlafenhamster 2016-08-21
  • 打赏
  • 举报
回复
PRB: Using CEdit SetModify/GetModify Returns Invalid Values Last reviewed: March 2, 1998 Article ID: Q155224 4.00 4.10 4.20 WINDOWS NT kbprg kbprb The information in this article applies to: The Microsoft Foundation Classes (MFC), included with: Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1, and 4.2 SYMPTOMS The CEdit::GetModify() and CEdit::SetModify() methods may be unreliable when the CEdit object is part of CEditView. Further, using these methods on a CEdit object that is part of a CEditView object may cause CEditView::LockBuffer(), CEditView::GetBufferLength(), and other CEditView methods to return invalid values. CAUSE Under Windows 95 and Win32s, CEditView uses CEdit::GetModify() and CEdit::SetModify() to indicate when an internal buffer--which mirrors the contents of the edit control--is current. As a result, you can experience unpredictable behavior if the class you derive from CEditView also uses this flag, for example: RESOLUTION The easiest workaround is to ignore the edit control's internal modified flag and define your own in the class you derived from CEditView: class CMyEditView : public CEditView { public: BOOL GetModify() { return m_bModified; } void SetModify(BOOL bModified) { m_bModified = bModified; } // Additional public members... protected: BOOL m_bModified; // Additional protected members... }; Keep this flag current by overriding OnChange() in the class you derived from CEditView. OnChange() is called any time the contents of the underlying edit control changes: void CMyEditView::OnChange() { m_bModified = TRUE; //Call base class's EN_CHANGE handler CEditView::OnEditChange(); } MORE INFORMATION CEdit::GetModify() and CEdit::SetModify() access an internal "dirty" flag that is maintained by the standard Windows edit control. These methods are useful in determining if the contents of an edit control have been modified since this flag was cleared. Due to limitations under Win32s and Windows 95, the MFC classes set an internal flag, afxData.bWin32s, to TRUE during initialization under either of these systems. When this flag is TRUE, CEditView uses a modified method to obtain the contents of the underlying edit control. Instead of reading data from the edit control each time you need it, CEditView maintains an internal buffer that mirrors the contents of the edit control. To ensure this buffer is updated when the contents of the edit control change, CEditView uses CEdit::GetModify() and CEdit::SetModify(). This can cause serious conflicts if your application also uses these methods. The problem is clearly demonstrated in the source code for CEditView::LockBuffer(). Instead of accessing the control directly each time, CEditView::LockBuffer() copies the edit control's contents to a local buffer. Then CEditView::LockBuffer() calls CEdit::SetModify() with an argument of FALSE to clear the dirty flag. If your program calls CEditView::LockBuffer() or one of the many CEditView members that call it, the buffer is updated only if CEdit::GetModify() returns TRUE (which indicates the edit control's contents have changed and the local buffer is no longer current). Because CEditView::LockBuffer() clears the edit control's modified flag, your program no longer relies on this flag. Please note, if your program clears this flag, CEditView::LockBuffer() returns the contents of the local buffer even if the contents of the edit control has changed. CEditView::LockBuffer() is also called by other CEditView members, such as GetBufferLength() and FindText().

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧