Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The title of this post does not accurately caption my question. I couldn't think of a concise caption.

In an MFC Doc/View application , once SetModifiedFlag() is called after user activity occurs, an MFC generated or called messagebox appears whenever an attempt is made to close an unsaved document.

I wish to change the colour of that MFC called or generated messagebox so as to match the colour of the controls and messageboxes n my application. How do I do this?

I am willing to override an appropriate MFC function that will enable me use my own custom messagebox, but I don't really know which function to override? Does anyone hear know the appropriate function to override?

What I have tried:

I have spent time googling to no avail.
Posted
Updated 7-Jun-17 21:01pm

1 solution

To implement your own message box override the virtual CDocument::SaveModified[^] function in your CDocument derived class:
BOOL CMyDocument::SaveModified()
{
    if (!IsModified())
        return TRUE;

    // Show your own message box here.
    // Return TRUE to continue and close the document, and
    //  FALSE if the document should not be closed.
}
You may also look at the default implementation in doccore.cpp in the MFC source directory.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900