Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Debug Assertion Failed when I create CXTOutBarCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Debug Assertion Failed when I create CXTOutBarCtrl

 Post Reply Post Reply
Author
Message
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post Topic: Debug Assertion Failed when I create CXTOutBarCtrl
    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?
Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post 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
}
 
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post 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;
}
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2007 at 6:04am

OK, I attach code here:

Can you attach your formview project at reply?
Thank you veru much!
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zjroland View Drop Down
Groupie
Groupie


Joined: 09 December 2006
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote zjroland Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.