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 when Adding CExtNCSB to CFormView Collapse All
Subject Author Date
Bill Olson Oct 14, 2010 - 2:45 AM

I’m trying to get skinned scroll bars to work with a CScrollView.  Searching the forum, I see where you recommended the PageContainer sample for an example of how to add skinned scroll bars to a view.  The sample uses CExtNCSB < CExtWS < CExtAFV < CFormView > > > with the class definition.  I tried adding this to my view class definition, and adding it in calls to the base class in the cpp file. 


When I try to run the program, it asserts down in the windows libraries, in the Child Frame OnCreateClient on the CreateView() call.


What am I doing wrong?


Bill

Bill Olson Oct 19, 2010 - 2:05 AM

That was it.  The scroll bars look good now.


Thanks,


Bill

Bill Olson Oct 14, 2010 - 7:21 PM

Here is the class definition:


class CFrmSwitch : public CExtNCSB < CExtWS < CExtAFV < CFormView > > >


The constructor:


CFrmSwitch::CFrmSwitch():CExtNCSB < CExtWS < CExtAFV < CFormView > > > ( CFrmSwitch::IDD, ((CWnd *)NULL) )


OnCreate:


int CFrmSwitch::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

    if (CExtNCSB<CExtWS<CExtAFV<CFormView> > >::OnCreate(lpCreateStruct) == -1)

        return -1;



    // TODO:  Add your specialized creation code here



    return 0;

}


I have a couple of other calls that call the default function with the same Prof-UIS functions ahead of it.  Changing CExtNCSB to CExtWA works, but does not skin the scroll bars.


When it stops, all the debugger says is that the program triggered a break point.  This happens even if no break points are set.  This is VS 2005 BTW.


Here is the stack when the debugger breaks:


     ntdll.dll!7c90120e()    

     [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]   

>    MultiTraceVI.exe!_CrtDbgBreak()  Line 89    C

     MultiTraceVI.exe!_VCrtDbgReportA(int nRptType=0x00000002, const char * szFile=0x01594948, int nLine=0x00000149, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00125f28)  Line 290    C

     MultiTraceVI.exe!_CrtDbgReportV(int nRptType=0x00000002, const char * szFile=0x01594948, int nLine=0x00000149, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00125f28)  Line 300 + 0x1d bytes    C

     MultiTraceVI.exe!_CrtDbgReport(int nRptType=0x00000002, const char * szFile=0x01594948, int nLine=0x00000149, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 317 + 0x1d bytes    C

     MultiTraceVI.exe!AfxAssertFailedLine(const char * lpszFileName=0x01594948, int nLine=0x00000149)  Line 25 + 0x13 bytes    C++

     MultiTraceVI.exe!CWnd::Attach(HWND__ * hWndNew=0x00dc159c)  Line 329 + 0x18 bytes    C++

     MultiTraceVI.exe!_AfxCbtFilterHook(int code=0x00000003, unsigned int wParam=0x00dc159c, long lParam=0x00126240)  Line 530    C++

     user32.dll!7e42b372()    

     user32.dll!7e44f8ee()    

     ntdll.dll!7c90e473()    

     user32.dll!7e42e389()    

     user32.dll!7e42e34f()    

     ntdll.dll!7c92770a()    

     ntdll.dll!7c927784()    

     ntdll.dll!7c96e5df()    

     ntdll.dll!7c96f8e8()    

     ntdll.dll!7c96f8cc()    

     ntdll.dll!7c96f8cc()    

     ntdll.dll!7c94bc4c()    

     ntdll.dll!7c927784()    

     ntdll.dll!7c918f21()    

     ntdll.dll!7c9101db()    

     gdi32.dll!77f193e4()    

     gdi32.dll!77f193ec()    

     ntdll.dll!7c927784()    

     ntdll.dll!7c927573()    

     ntdll.dll!7c91005d()    

     user32.dll!7e419c2e()    

     user32.dll!7e419c17()    

     user32.dll!7e419d4d()    

     user32.dll!7e419d60()    

     ntdll.dll!7c91005d()    

     kernel32.dll!7c8099fa()    

     kernel32.dll!7c809a0d()    

     gdi32.dll!77f1a6fc()    

     kernel32.dll!7c809a0d()    

     gdi32.dll!77f1a782()    

     user32.dll!7e42c68a()    

     user32.dll!7e42c70b()    

     gdi32.dll!77f17598()    

     user32.dll!7e42c68a()    

     user32.dll!7e42c70b()    

     user32.dll!7e426423()    

     user32.dll!7e4249b1()    

     user32.dll!7e43a956()    

     MultiTraceVI.exe!_output_s_l(_iobuf * stream=0x00a5160e, const char * format=0x00188190, localeinfo_struct * plocinfo=0x00188418, char * argptr=0x00012012)  Line 1166 + 0x17 bytes    C++

     user32.dll!7e4664a2()    

     user32.dll!7e450877()    

     user32.dll!7e45082f()    

     MultiTraceVI.exe!__crtMessageBoxA(const char * lpText=0x00126eec, const char * lpCaption=0x01647334, unsigned int uType=0x00012012)  Line 168 + 0x13 bytes    C

     MultiTraceVI.exe!__crtMessageWindowA(int nRptType=0x00000002, const char * szFile=0x01594de0, const char * szLine=0x00128f60, const char * szModule=0x00000000, const char * szUserMessage=0x00127f60)  Line 420 + 0x16 bytes    C

     MultiTraceVI.exe!_VCrtDbgReportA(int nRptType=0x00000002, const char * szFile=0x01594de0, int nLine=0x00000272, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012cff4)  Line 420 + 0x28 bytes    C

     MultiTraceVI.exe!_CrtDbgReportV(int nRptType=0x00000002, const char * szFile=0x01594de0, int nLine=0x00000272, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012cff4)  Line 300 + 0x1d bytes    C

     MultiTraceVI.exe!_CrtDbgReport(int nRptType=0x00000002, const char * szFile=0x01594de0, int nLine=0x00000272, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 317 + 0x1d bytes    C

     MultiTraceVI.exe!AfxAssertFailedLine(const char * lpszFileName=0x01594de0, int nLine=0x00000272)  Line 25 + 0x13 bytes    C++

     MultiTraceVI.exe!AfxHookWindowCreate(CWnd * pWnd=0x02e18078)  Line 626 + 0x18 bytes    C++

     MultiTraceVI.exe!CWnd::CreateEx(unsigned long dwExStyle=0x00100000, const wchar_t * lpszClassName=0x01673e90, const wchar_t * lpszWindowName=0x01673e90, unsigned long dwStyle=0x46000000, int x=0x00000000, int y=0x00000000, int nWidth=0x00000000, int nHeight=0x00000000, HWND__ * hWndParent=0x00010016, HMENU__ * nIDorHMenu=0xffffffff, void * lpParam=0x00000000)  Line 694    C++

     MultiTraceVI.exe!CWnd::CreateEx(unsigned long dwExStyle=0x00100000, const wchar_t * lpszClassName=0x01673e90, const wchar_t * lpszWindowName=0x01673e90, unsigned long dwStyle=0x46000000, const tagRECT & rect={...}, CWnd * pParentWnd=0x02dcf9a8, unsigned int nID=0xffffffff, void * lpParam=0x00000000)  Line 659    C++

     MultiTraceVI.exe!CExtNCSB_ScrollContainer::Create(CWnd * pWndParent=0x02dcf9a8)  Line 3259 + 0x2e bytes    C++

     MultiTraceVI.exe!CExtNCSB_Impl<CExtWS<CExtAFV<CFormView>,301> >::NCSB_InstantiateAndCreateContainer(CExtNCSB_ScrollContainer::e_mode_t eMode=__EM_HORIZONTAL_SCROLL_BAR, CWnd * pWndParent=0x02dcf9a8)  Line 589 + 0x16 bytes    C++

     MultiTraceVI.exe!CExtNCSB_Impl<CExtWS<CExtAFV<CFormView>,301> >::NCSB_EnsureContainersCreated()  Line 630 + 0x18 bytes    C++

     MultiTraceVI.exe!CExtNCSB_Impl<CExtWS<CExtAFV<CFormView>,301> >::NCSB_RepositionContainers(bool bRescanScrollPositions=true)  Line 897 + 0x12 bytes    C++

     MultiTraceVI.exe!CExtNCSB_Impl<CExtWS<CExtAFV<CFormView>,301> >::PreSubclassWindow()  Line 1058 + 0x14 bytes    C++

     MultiTraceVI.exe!_AfxCbtFilterHook(int code=0x00000003, unsigned int wParam=0x00c6158e, long lParam=0x0012dec4)  Line 532    C++

     user32.dll!7e42b372()    

     user32.dll!7e44f8ee()    

     ntdll.dll!7c90e473()    

     user32.dll!7e42e389()    

     user32.dll!7e42e34f()    

     ntdll.dll!7c92770a()    

     ntdll.dll!7c927784()    

     ntdll.dll!7c96e5df()    

     ntdll.dll!7c96f8e8()    

     ntdll.dll!7c96f8cc()    

     ntdll.dll!7c96f8cc()    

     ntdll.dll!7c94bc4c()    

     ntdll.dll!7c927784()    

     gdi32.dll!77f19320()    

     gdi32.dll!77f192fb()    

     gdi32.dll!77f193e4()    

     gdi32.dll!77f193ec()    

     ntdll.dll!7c927784()    

     ntdll.dll!7c927573()    

     ntdll.dll!7c91005d()    

     MultiTraceVI.exe!ATL::CSimpleStringT<wchar_t,0>::SetString(const wchar_t * pszSrc=0x00000000, int nLength=0x02734fb8)  Line 663 + 0x10 bytes    C++

     user32.dll!7e42c70b()    

     gdi32.dll!77f17598()    

     gdi32.dll!77f16b25()    

     user32.dll!7e42c70b()    

     user32.dll!7e42f2cf()    

     user32.dll!7e426423()    

     user32.dll!7e42683e()    

     user32.dll!7e43f03a()    

     MultiTraceVI.exe!CWnd::CreateDlgIndirect(const DLGTEMPLATE * lpDialogTemplate=0x017ebd70, CWnd * pParentWnd=0x02e191d0, HINSTANCE__ * hInst=0x00400000)  Line 315 + 0x2a bytes    C++

     MultiTraceVI.exe!CWnd::CreateDlg(const wchar_t * lpszTemplateName=0x00000084, CWnd * pParentWnd=0x02e191d0)  Line 226 + 0x14 bytes    C++

     MultiTraceVI.exe!CFormView::Create(const wchar_t * __formal=0x00000000, const wchar_t * __formal=0x00000000, unsigned long dwRequestedStyle=0x50800000, const tagRECT & rect={...}, CWnd * pParentWnd=0x02e191d0, unsigned int nID=0x0000e900, CCreateContext * pContext=0x0012fabc)  Line 105 + 0x16 bytes    C++

     MultiTraceVI.exe!CFrameWnd::CreateView(CCreateContext * pContext=0x0012fabc, unsigned int nID=0x0000e900)  Line 594 + 0x33 bytes    C++

     MultiTraceVI.exe!CChildSwitch::OnCreateClient(tagCREATESTRUCTW * __formal=0x0012ede8, CCreateContext * pContext=0x0012fabc)  Line 61 + 0x11 bytes    C++

     MultiTraceVI.exe!CFrameWnd::OnCreateHelper(tagCREATESTRUCTW * lpcs=0x0012ede8, CCreateContext * pContext=0x0012fabc)  Line 634 + 0x18 bytes    C++

     MultiTraceVI.exe!CMDIChildWnd::OnCreate(tagCREATESTRUCTW * lpCreateStruct=0x0012ede8)  Line 1044    C++

     MultiTraceVI.exe!CChildSwitch::OnCreate(tagCREATESTRUCTW * lpCreateStruct=0x0012ede8)  Line 503 + 0xc bytes    C++

     MultiTraceVI.exe!CWnd::OnWndMsg(unsigned int message=0x00000001, unsigned int wParam=0x00000000, long lParam=0x0012ede8, long * pResult=0x0012eaf4)  Line 2000 + 0xd bytes    C++

     MultiTraceVI.exe!CWnd::WindowProc(unsigned int message=0x00000001, unsigned int wParam=0x00000000, long lParam=0x0012ede8)  Line 1741 + 0x20 bytes    C++

     MultiTraceVI.exe!CExtNCW<CMDIChildWnd>::WindowProc(unsigned int message=0x00000001, unsigned int wParam=0x00000000, long lParam=0x0012ede8)  Line 375 + 0x14 bytes    C++

     MultiTraceVI.exe!AfxCallWndProc(CWnd * pWnd=0x02e191d0, HWND__ * hWnd=0x00711680, unsigned int nMsg=0x00000001, unsigned int wParam=0x00000000, long lParam=0x0012ede8)  Line 240 + 0x1c bytes    C++

     MultiTraceVI.exe!AfxWndProc(HWND__ * hWnd=0x00711680, unsigned int nMsg=0x00000001, unsigned int wParam=0x00000000, long lParam=0x0012ede8)  Line 389    C++

     user32.dll!7e418734()    

     user32.dll!7e418816()    

     user32.dll!7e428ea0()    

     user32.dll!7e42ce7c()    

     ntdll.dll!7c90e473()    

     MultiTraceVI.exe!CExtUxTheme::GetThemeInt(int iPartId=0x0012f210, int iStateId=0x00000000, int iPropId=0x7e410000, int * piVal=0x7e4100d8)  Line 777 + 0x2b bytes    C++

     ntdll.dll!7c910323()    

     ntdll.dll!7c910385()    

     ntdll.dll!7c910323()    

     ntdll.dll!7c910385()    

     ntdll.dll!7c912465()    

     user32.dll!7e42cecb()    

     user32.dll!7e42ed8d()    

     user32.dll!7e42cecb()    

     user32.dll!7e42ed8d()    

     user32.dll!7e42ec6d()    

     user32.dll!7e42ebb2()    

     user32.dll!7e42cecb()    

     user32.dll!7e43fda4()    

     user32.dll!7e43fa8c()    

     user32.dll!7e43fcb3()    

     user32.dll!7e42e442()    

     MultiTraceVI.exe!CExtUxTheme::GetThemeInt(int iPartId=0x00000000, int iStateId=0x00400000, int iPropId=0x0012fabc, int * piVal=0x7e43049b)  Line 777 + 0x2b bytes    C++

     MultiTraceVI.exe!CExtUxTheme::GetThemeInt(int iPartId=0x00000000, int iStateId=0x00400000, int iPropId=0x0012fabc, int * piVal=0x7e43049b)  Line 777 + 0x2b bytes    C++


The assert happened a few lines back in the stack, but it’s in wincore.cpp here:


BOOL CWnd::Attach(HWND hWndNew)

{

>Here>    ASSERT(m_hWnd == NULL);     // only attach once, detach on destroy

    ASSERT(FromHandlePermanent(hWndNew) == NULL);

        // must not already be in permanent map



    if (hWndNew == NULL)

        return FALSE;



    CHandleMap* pMap = afxMapHWND(TRUE); // create map if not exist

    ASSERT(pMap != NULL);



    pMap->SetPermanent(m_hWnd = hWndNew, this);


 


 


 

Technical Support Oct 16, 2010 - 7:46 AM

You encountered a conflict of MFC’s window creation hooking mechanism. It does not like any new windows to be created until the creation of currently hooked window is complete. To resolve this conflict you should use delayed initialization of scroll bars in the CExtNCSB template class. This means you should invoke the constructor of the CExtNCSB template class explicitly. Here is how we did this in the FunnyBars sample application:

CChildView::CChildView()
            : CExtNCSB < CExtWS < CExtAFV < CFormView > > > ( CChildView::IDD, ((CWnd *)NULL), true )

The true flag turns on the delayed scroll bar initialization.

Technical Support Oct 14, 2010 - 12:19 PM

It is difficult to say without some additional info. Could you provide the content of the Call Stack window and the source code of your scrollable view class so that we can help you more efficiently?