Article ID: 839297 - Last Review: January 17, 2006 - Revision: 2.0

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

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
Expand all | Collapse all

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("Warning: CreateDlgControls failed during dialog bar init.\n");
			return FALSE;
		}
	}
	return TRUE;  <-- this is set to FALSE in VC++ .NET 2002/2003
}

REFERENCES

For additional information about how to override CDialogBar class functions, click the following article number to view the article in the Microsoft Knowledge Base:
185672  (http://support.microsoft.com/kb/185672/ ) HOWTO: How to initialize child controls in a derived CDialogBar

APPLIES TO
  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
Keywords: 
kbinfo kbdlg kbmfcctrlbar kbcode KB839297