Microsoft KB Archive/117607

From BetaArchive Wiki
Knowledge Base


FIX: Common Dialog Classes Don't Update DDX Member Variables

Article ID: 117607

Article Last Modified on 11/21/2006



APPLIES TO

  • Microsoft Foundation Class Library 4.2, when used with:
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 1.5 Professional Edition
    • Microsoft Visual C++ 1.0 Professional Edition



This article was previously published under Q117607

SYMPTOMS

If you use classes derived from the common dialog classes (for example CFileDialog) in the MFC, DDX member variables do not get updated when you choose the "OK" button. The reason for this is that the base class "OnOK()", provided for these classes, does not call UpdateData(). For example, CFileDialog::OnOK() does not call UpdateData().

RESOLUTION

The workaround for this is to override OnOK() in your derived class and call UpdateData(). See CDialog::OnOK() in <drive>:\MSVC\MFC\SRC\DLGCORE.CPP for an example of how to set up the code and message-map entry.

STATUS

Microsoft has confirmed this to be a problem in the MFC, versions 2.0 and 2.5. This problem was corrected in MFC version 3.0, included with Visual C++ version 2.0.


Additional query words: ok button CPrintDialog CColorDialog CFontDialog 1.00 1.50 2.00 2.50 2.10 kbNoUpdate

Keywords: kbbug kbfix kbvc200fix KB117607