Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Problem with minitoolbar Assert
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with minitoolbar Assert

 Post Reply Post Reply
Author
Message
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Topic: Problem with minitoolbar Assert
    Posted: 23 July 2009 at 9:22pm
Hi all. New to the Toolkit and struggling a bit with a MinitToolbar problem.

I have a CXTPCommandBarsSiteBase<CWnd> derived class and I use the CommandBars from this to host my CXTPMiniToolbar. Inside my derived class I have a CRichEdit and I pop up the MiniToolbar when the user right clicks.

Unfortunately when I call TrackMiniBar, the application ASSERTS in wincore.cpp, line 883 while checking the window handle of the parent window. Here is the callstack.

CWnd::AssertValid() line 883 + 67 bytes
AfxAssertValidObject(const CObject * 0x0537b3a8 {NoteDashboardWidget}, const char * 0x5f8d06e0 THIS_FILE, int 738) line 108
CCmdUI::DoUpdate(CCmdTarget * 0x0537b3a8 {NoteDashboardWidget}, int 1) line 740
CXTPCommandBar::OnUpdateCmdUI() line 734
CXTPCommandBar::OnIdleUpdateCmdUI(unsigned int 1, unsigned int 1) line 595
CXTPPopupBar::Popup(CXTPControlPopup * 0x00000000 {CXTPControlPopup}, int 0) line 1072 + 20 bytes
CXTPPopupBar::Popup(int 810, int 249, const tagRECT * 0x0012fafc {top=0 bottom=0 left=0 right=0}) line 1101 + 20 bytes
CXTPMiniToolBar::TrackMiniBar(unsigned int 0, int 810, int 249) line 182 + 40 bytes
RichStringEditView::OnLButtonUp(unsigned int 0, CPoint {x=810 y=264}) line 290 + 30 bytes
CWnd::OnWndMsg(unsigned int 514, unsigned int 0, long 589893, long * 0x0012fcc4) line 1964
CWnd::WindowProc(unsigned int 514, unsigned int 0, long 589893) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x0537b480 {RichStringEditView hWnd=???}, HWND__ * 0x00260d3e, unsigned int 514, unsigned int 0, long 589893) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x00260d3e, unsigned int 514, unsigned int 0, long 589893) line 368
AfxWndProcBase(HWND__ * 0x00260d3e, unsigned int 514, unsigned int 0, long 589893) line 220 + 21 bytes
USER32! 7e418734()
USER32! 7e418816()
USER32! 7e4189cd()
USER32! 7e418a10()
CWinThread::PumpMessage() line 846
CWinThread::Run() line 480 + 11 bytes
CWinApp::Run() line 400
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, unsigned short * 0x0002099e, int 1) line 49 + 11 bytes
wWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, unsigned short * 0x0002099e, int 1) line 30
wWinMainCRTStartup() line 330 + 55 bytes
KERNEL32! 7c817077()

I can't for the life of me figure out what's wrong. The minitoolbar appears OK, with the controls enabled/initialised OK, but something's going screwy somewhere.

Is this a threading issue at all, or some other thing I need to be aware of with mini toolbars? I am using the toolbar class I have elsewhere and it's working fine when it's the RichEdit is inside a CXTPFrameWnd.

Any help appreciated.
Aaron
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
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: 24 July 2009 at 4:03am
Hi,
trace shows something wrong with NoteDashboardWidget. Is it custom control on toolbar ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2009 at 6:27pm
Hi Oleg. NoteDashboardWidget is my CXTPCommandBarsSiteBase <CWnd> derived class that I use as the anchor for the command bars. Inside that I have the CRichEdit control. When I select or right click on the CRichEdit, I call TrackMiniBar. The code where the asserts are happening is this:

     ASSERT(HWND_TOP == NULL);       // same as desktop
     if (m_hWnd == HWND_BOTTOM)
          ASSERT(this == &CWnd::wndBottom);
     else if (m_hWnd == HWND_TOPMOST)
          ASSERT(this == &CWnd::wndTopMost);
     else if (m_hWnd == HWND_NOTOPMOST)
          ASSERT(this == &CWnd::wndNoTopMost);
     else
     {
          // should be a normal window
          ASSERT(::IsWindow(m_hWnd));

And this line

          ASSERT(this == &CWnd::wndNoTopMost);

seems to be where the assert happens but my IDE isn't being too helpful and placing the breakpoint inbetween that line and the next one (ISWindow) call. I've tried copying that code into my own area before calling TrackMiniBar and nothing is asserted. So I'm obviously missing something and assume I'm not setting things up correctly for the mini toolbar.
What is the normal procedure for setting up and using a minitoolbar? Are there any restrictions or requirements?

I should add that the code for the NoteDashboardWidget is in an external DLL to the main application.

Thanks.
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
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.141 seconds.