Article ID: 189352
Article Last Modified on 11/21/2006
void CPrintDialog::OnPrintSetup()
{
ASSERT_VALID(this);
CPrintDialog* pDlgSetup = AttachOnSetup();
ASSERT(pDlgSetup != NULL);
_AfxHookWindowCreate(pDlgSetup);
Default();
_AfxUnhookWindowCreate();
delete pDlgSetup;
}
Before calling Default(), MFC installs a WH_CALLWNDPROC hook function
(_AfxSendMsgHook) through _AfxHookWindowCreate. Default() invokes the
callback function in the printer driver. If the printer driver displays an
MFC window (usually a property sheet), _AfxHookWindowCreate is called again
and the subclassing needed in _AfxSendMsgHook is done improperly. In most
cases, an assertion occurs in Wincore.cpp line 210:
LRESULT CALLBACK AFX_EXPORT
AfxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CWnd* pWnd;
pWnd = CWnd::FromHandlePermanent(hWnd);
ASSERT(pWnd != NULL); // LINE 210
ASSERT(pWnd->m_hWnd == hWnd);
LRESULT lResult = _AfxCallWndProc(pWnd, hWnd, message,
wParam, lParam);
return lResult;
}
This problem occurs when you use 16-bit drivers with MFC and with MFC as
the calling program. Note that the problem can still occur if the calling
program is a 32-bit application running on Windows 95 or Win32s.
Keywords: kbarchitecture kbcmndlgpage kbcmndlgprint kbnoupdate kbprb kbprint kbpropsheet KB189352