You come across the MFC’s window creation hooking mechanism. It does not allow creating windows until the current window creation event is finally handled. The CExtNCSB
template class may require delayed scroll bar initialization mode in such particular cases because it creates two scroll bar windows and corner area window between scroll bars. This means your scrollable view window should invoke the parent class constructor explicitly. Please take a closer look at the CFormEditorView
class constructor source code in the FormEditor sample application:
CFormEditorView::CFormEditorView()
: CExtNCSB < CScrollView > ( true )
, m_sizeGridStep( 8, 8 )
, m_sizeDropArea( 100, 25 )
, m_rcLastDropArea( 0, 0, 0, 0 )
, m_dwTrackingCreation( __IMG_TOOLBOX_POINTER )
, m_bTrackingCreation( false )
, m_bCanceling( false )
, m_rcTrackingCreation( 0, 0, 0, 0 )
, m_hWndSizeCursorHitTest( NULL )
, m_nSizeCursorHitTest( -1 )
, m_bSizingControl( false )
, m_bGroupMoving( false )
, m_ptMoveCurr( -1, -1 )
, m_bTabOrderMode( false )
, m_nTabClickNo( 0 )
{
VERIFY( RegisterFormEditorWndClass() );
}
The following line is what you need:
: CExtNCSB < CScrollView > ( true )
This is the explicit invocation of the
CExtNCSB
template class constructor and it contains the
true
parameter flag indicating that scroll bars and corner area window should be created with a delay.