Print Page | Close Window

Debug Assertion Failed when I create CXTOutBarCtrl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=6028
Printed Date: 18 May 2024 at 9:04am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Debug Assertion Failed when I create CXTOutBarCtrl
Posted By: zjroland
Subject: Debug Assertion Failed when I create CXTOutBarCtrl
Date Posted: 07 January 2007 at 8:35pm
I have a FormView CSoftView: 
class CSoftView : public CFormView
When I create a CXTOutBarCtrl at OnInitialUpdate()
void CSoftView::OnInitialUpdate()
{
    m_myOutBarCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, CRect(0,0,0,0), this,IXT_OUTLOOKBAR, OBS_XT_DEFAULT)
}
then began "debug asssertion failed",  Why?



Replies:
Posted By: kstowell
Date Posted: 08 January 2007 at 1:08am
Hi,
 
I used AppWizard and created a MDI form view app then added the above code you mentioned and was not able to reproduce the problem. Make sure you check your dialog form view resource to ensure it is valid.
 
Regards,
Codejock Support


Posted By: zjroland
Date Posted: 08 January 2007 at 2:32am
In CDialog, everything is OK, but in CFormView, Debug Assertion Failed when I create CXTOutBarCtr .
I think the reason is that we can't use "this" to point to a pParentWnd. you can try to add a CXTOutBarCtr  in your sample-TabbedView.


Posted By: Oleg
Date Posted: 08 January 2007 at 2:50am
Hello,
try to call OnInitialUpdate() of base class first.
 
What line generates assert?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: zjroland
Date Posted: 08 January 2007 at 4:45am
void CSoftView::OnInitialUpdate()
{
    CFormView::OnInitialUpdate();
    m_softOutBarExpert.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this,IXT_OUTLOOKBAR, OBS_XT_DEFAULT)  //here generates assert
}
 


Posted By: zjroland
Date Posted: 08 January 2007 at 4:52am
Then I followed the code to XTOutbarCtrl.cpp:
BOOL CXTOutBarCtrl::CreateEx(DWORD dwExStyle, DWORD dwStyle, const RECT&  rect, CWnd* pParentWnd, UINT nID, const DWORD dwFlags)
{
 ASSERT(dwStyle & WS_CHILD);
 ASSERT_VALID(pParentWnd);                           //here generates assert
 if(!CWnd::CreateEx(dwExStyle, NULL, NULL, dwStyle, rect, pParentWnd, nID)) {
  return FALSE;
 }
 m_dwFlags = dwFlags;
 return TRUE;
}


Posted By: Oleg
Date Posted: 08 January 2007 at 5:00am
Hello,
You do something wrong. I create new project with CFormView as view, inserted

m_softOutBarExpert.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,100,100), this,100, OBS_XT_DEFAULT);

and

CXTOutBarCtrl m_softOutBarExpert;

all work as expected.
Attach your project to check what you do.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: zjroland
Date Posted: 08 January 2007 at 6:04am

OK, I attach code here:

http://www.outsourcexp.com/TabbedView.zip - http://www.outsourcexp.com/TabbedView.zip
Can you attach your formview project at reply?
Thank you veru much!


Posted By: zjroland
Date Posted: 08 January 2007 at 6:27am

in release mode, it's OK, but in debug mode,

wincore.cpp  626 line generates assert

ASSERT(pWnd->m_hWnd == NULL);   // only do once


Posted By: Oleg
Date Posted: 08 January 2007 at 7:50am

Hi,

Problem that OnInitialUpdate called twice.
 
Remove
 
pWnd->SendMessage(WM_INITIALUPDATE);
 
from CTabbedViewView::AddView.
 
 
This line was in old releases of our sample. In last releases it was removed.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: zjroland
Date Posted: 08 January 2007 at 8:34am
It works now,thank you oleg.without your help , I will never know where the problem is.
Thank you again.
 
Roland Richard



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net