Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » ASSERT at startup using CExtNCSB Collapse All
Subject Author Date
Cameron Feb 1, 2010 - 12:24 PM

hello,
i have an existing Visual Studio 6.0 project that uses CScrollView and am migrating it to Prof-UIS, but when i drop in CExtNCSB<CScrollView> to replace CScrollView, as in the FormEditor example, i now get an assert at startup in AfxHookWindowCreate at the line:

    ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress

i have reproduced this in a simple MFC program using the MFC application wizard and replacing CView with CExtNCSB<CScrollView>, and changing nothing else from the wizard-generated code. any ideas what i am doing wrong? thanks in advance for your help!
regards,
cameron

Cameron Feb 1, 2010 - 1:14 PM

that did it, thanks for the quick response!
cameron

Technical Support Feb 1, 2010 - 12:44 PM

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.