![]() |
Debug Assertion Failed when I create CXTOutBarCtrl |
Post Reply ![]() |
Author | |
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() 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?
|
|
![]() |
|
kstowell ![]() Admin Group ![]() Joined: 25 January 2003 Location: MIchigan, USA Status: Offline Points: 496 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
try to call OnInitialUpdate() of base class first.
What line generates assert?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
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
}
|
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
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;
} |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
OK, I attach code here: Can you attach your formview project at reply?
Thank you veru much!
|
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
in release mode, it's OK, but in debug mode, wincore.cpp 626 line generates assert ASSERT(pWnd->m_hWnd == NULL); // only do once
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
zjroland ![]() Groupie ![]() Joined: 09 December 2006 Status: Offline Points: 42 |
![]() ![]() ![]() ![]() ![]() |
It works now,thank you oleg.without your help , I will never know where the problem is.
Thank you again.
Roland Richard
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |