Error: [$parse:syntax]$parse/syntax?p0=undefined&p1=not%20a%20primary%20expression&p2=null&p3=%3C%2FAngularNoBind%3EAFX_DATA_INIT(CMyPrintDialog)%0A%20%20%20%20%20%20%2F%2F%3CAngularNoBind%3E&p4=%3C%2FAngularNoBind%3EAFX_DATA_INIT(CMyPrintDialog)%0A%20%20%20%20%20%20%2F%2F%3CAngularNoBind%3E at throwError ( at primary ( at unary ( at multiplicative ( at additive ( at relational ( at relational ( at relational ( at relational ( at equality ( at logicalAND ( at logicalOR ( at ternary ( at assignment ( at expression ( at filterChain ( at statements ( at parse ( at at f ( at yi ( at kt ( at bt ( at bt ( at bt ( at bt ( at bt ( at wt ( at at $digest ( at $apply ( at ut ( at ft ( at onreadystatechange ( undefined Microsoft Support

MFC does not call the CPrintDialog::OnInitDialog function in Visual C++ 6.0

This article was previously published under Q193272
This article has been archived. It is offered "as is" and will no longer be updated.
The OnInitDialog() function (which is called in response to a WM_INITDIALOGmessage) for a CPrintDialog-derived class, was called in MFC prior toVisual C++ 6.0. However, this is no longer true for MFC DLLs of Visual C++6.0. Therefore, programs that rely on OnInitDialog() to be called will notwork as expected.
Previously, MFC set up a message hook for CPrintDialog. This hook was theonly way to catch a WM_INITDIALOG message. MFC for Visual C++ 6.0 purposelyremoved this hook so MFC applications would automatically get the new Printdialog by default on Windows 2000; however, this causes applications thatrely on CPringDialog::OnInitDialog() to fail to work.
Set up the message hook function, _AfxCommDlgProc(), in theconstructor of your CPrintDialog-derived class as shown below:
   // CMyPrintDialog is a CPrintDialog-derived class.   CMyPrintDialog::CMyPrintDialog(DWORD dwFlags)   : CPrintDialog(FALSE,dwFlags)   {      //<AngularNoBind>{{</AngularNoBind>AFX_DATA_INIT(CMyPrintDialog)      //<AngularNoBind>}}</AngularNoBind>AFX_DATA_INIT      // MFCBUG: MFC 6.0 doesn't set the message hook!      m_pd.Flags |= PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK;      // _AfxCommDlgProc is exported from static MFC libraries      m_pd.lpfnPrintHook = _AfxCommDlgProc;      m_pd.lpfnSetupHook = _AfxCommDlgProc;   }				
Then, make your project statically linked to MFC.
Microsoft has confirmed this to be a bug in the Microsoft products listedat the beginning of this article. This bug has been fixed in the VisualStudio 6.0 Service Pack 1.

To obtain this service pack, visit the following MIcrosoft Developer Network (MSDN) Web site:For more information about Visual Studio 6.0 Service Pack 1, click the following article numbers to view the articles in the Microsoft Knowledge Base:
193009 Visual Studio 6.0 Service Pack 1 readme
194022 Visual Studio 6.0 service packs, what, where, why
194295 How to tell that a Visual Studio service pack is installed

Steps to reproduce the behavior

  1. Derive a class from CPrintDialog.
  2. Add a message handler for WM_INITDIALOG in the CPrintDialog-derived class. The message handler OnInitDialog() is not called in Visual C++ 6.0.
(c) Microsoft Corporation 1998, All Rights Reserved.Contributions by Yeong-Kah Tam, Microsoft Corporation.