BUG: Finish Button Fails Data Transfer from Page to Variables

Last reviewed: June 26, 1997
Article ID: Q150349
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, 4.2, 5.0

SYMPTOMS

When you're using a wizard-style property sheet with DDX routines, data is not transferred from the current page to the corresponding variables when you click the Finish button.

CAUSE

MFC relies on the PSN_KILLACTIVE notification handler, OnKillActive(), to call UpdateData(TRUE). This notification is not sent when you click the Finish button, so UpdateData(TRUE) is not called to allow data transfer by way of DDX.

RESOLUTION

When you click the Finish button, a PSN_WIZFINISH notification is sent. To allow the DDX routines to transfer data from the page to the corresponding variables, derive a class from CPropertyPage, and override the virtual function OnWizardFinish(). In OnWizardFinish(), place a call to UpdateData(TRUE).

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

When a user clicks the Back or Next button on a wizard page, the page loses the focus and consequently receives a PSN_KILLACTIVE notification message. When it receives the PSN_KILLACTIVE notification, the virtual function of the wizard page, OnKillActive(), calls UpdateData(TRUE). This call allows the DDX routines to transfer data from the page to the corresponding variables. However, when the Finish button is clicked, a PSN_KILLACTIVE notification is not sent, so UpdateData(TRUE) is not called.

Sample Code

   /* Compile options needed: default
   */

   BOOL CMyPropertyPage::OnWizardFinish()
   {
       if (!UpdateData())  //note: parameter is TRUE by default
       {
           TRACE0("UpdateData failed during wizard finish\n");
           return FALSE;
       }
       return CPropertyPage::OnWizardFinish();
   }


Additional query words: CPropertySheet
Keywords : kbprg MfcMisc vcbuglist500 kbbuglist
Technology : kbMfc
Version : 4.00 4.10 4.20 5.00
Platform : NT WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 26, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.