Microsoft KB Archive/839297

= Difference between the return value of the CDialogBar::HandleInitDialog function in Visual C++ 6.0 and that in Visual C++ .NET or that in Visual C++ 2005 =

Article ID: 839297

Article Last Modified on 1/17/2006

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-





INTRODUCTION
In Microsoft Visual C++ 6.0, the CDialogBar::HandleInitDialog function returns a TRUE value. In Microsoft Visual C++ .NET 2002, in Microsoft Visual C++ .NET 2003, and in Microsoft Visual C++ 2005, the return value of the CDialogBar::HandleInitDialog function in the bardlg.cpp file that is part of Microsoft Foundation Classes (MFC) class library has been changed to FALSE.



MORE INFORMATION
You can still return a TRUE value if you want. To do this, you must override the HandleInitDialog function of the CDialogBar class in the derived class, and then add your own handler for the WM_INITDIALOG message that returns the TRUE value. Your derived class code must look similar to the following code: BEGIN_MESSAGE_MAP(CMyDlgBar,CDialogBar) ON_MESSAGE(WM_INITDIALOG, HandleInitDialog) END_MESSAGE_MAP

LRESULT CMyDlgBar::HandleInitDialog(WPARAM, LPARAM) {   Default;  // allow default to initialize first (common dialogs/etc)

// create OLE controls COccManager* pOccManager = afxOccManager; if ((pOccManager != NULL) && (m_pOccDialogInfo != NULL)) {       if (!pOccManager->CreateDlgControls(this, m_lpszTemplateName, m_pOccDialogInfo)) {           TRACE0(&quot;Warning: CreateDlgControls failed during dialog bar init.\n&quot;); return FALSE; }   }    return TRUE;  <-- this is set to FALSE in VC++ .NET 2002/2003 }

