Print Page | Close Window

CXTPDatePickerControl deconstructor causing assert

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=4855
Printed Date: 29 April 2024 at 1:50am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPDatePickerControl deconstructor causing assert
Posted By: Enclaved Shadow
Subject: CXTPDatePickerControl deconstructor causing assert
Date Posted: 22 August 2006 at 3:31pm
I am receiving a Debug Assertion Failed on line 1013 in the microsoft file wincore.cpp when I run the following code:
 
 
void CMyDlg::OnBtnCalendar()
{
     COleDateTime oDate;
     CRect oRect;
     CString oEquationDate;
     CXTPDatePickerControl oDatePicker;
     CXTPWindowRect oPopUpRect(m_obtnCalendar.GetSafeHwnd());
   
     oDatePicker.GetMinReqRect(&oRect);
     oDatePicker.SetButtonsVisible(FALSE, FALSE);
     oRect.InflateRect(0 ,0, 4, 4);
     oRect.OffsetRect(oPopUpRect.right - oRect.Width(), oPopUpRect.bottom);
 
     if (oDatePicker.GoModal(oRect))
     {
         oDatePicker.GetCurSel(oDate);
         oEquationDate = oDate.Format(_T("\"%Y%m%d\""));
         AddText(oEquationDate, FALSE);
     }
}
 
The assertion does not happen until it hits the deconstructor for CXTPDatePickerControl.  It appears as though I can safely ignore the assertion but the boss has a problem with all debug assertions.  The first line in the deconstructor is:
XTPGetTopLevelWndMsgNotifier()->Unadvise(this);
Unadvise eventually calls VERIFY(DestroyWindow()) which then eventually makes its way down to line 1013 and asserts at ASSERT(m_hWnd == hWndOrig);
 
Has anyone else experienced this problem and/or been able to come up with a solution? 
 
thanks.



Replies:
Posted By: Oleg
Date Posted: 22 August 2006 at 4:11pm
Hi,
What Toolkit version? What VC version?


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


Posted By: Enclaved Shadow
Date Posted: 23 August 2006 at 8:00am
Originally posted by oleg oleg wrote:

Hi,
What Toolkit version? What VC version?
We're using ToolkitPro 10.2


Posted By: Oleg
Date Posted: 23 August 2006 at 4:51pm
Hello,
I modified our DialogSample, added your code but don't see any problems.
please try it, do you see it on your computer?
 
https://forum.codejock.com/uploads/20060823_165119_DialogSample.zip - uploads/20060823_165119_DialogSample.zip
 


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


Posted By: Enclaved Shadow
Date Posted: 25 August 2006 at 10:48am

The Calendar control is in a dialog that is loaded from an MFC extension DLL.  When we create the dialog off a pane on the apps main window we do not see the exception.  When we create the dialog from a button being pushed in a control on another dialog we get the exception.  The problem is getting to be a bit larger now because themes do not seem to be working correctly either.  I have played around with the Button sample project found in file://\\CodeJock\ToolkitPro\Samples\Controls\Button - \\CodeJock\ToolkitPro\Samples\Controls\Button  and can get everything to work correctly in there but when I copy the code line for line into our app it does not work correctly.  The themes never seem to work correctly.  When we use themes the backgroud colour of the button is always defaulting to the same colour as the dialog's background and the button borders are never being drawn.

 
The problem is not there in the DialogSample.zip, it works fine.


Posted By: Oleg
Date Posted: 25 August 2006 at 4:07pm

Hello,

May be you can modify attached sample/add MFC extension to show problem?


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


Posted By: Enclaved Shadow
Date Posted: 19 September 2006 at 10:59am
The problem was that MFC was using the incorrect window handle map when trying to destroy the window.  I added AFX_MANAGE_STATE(AfxGetAppModuleState()); to the top of the void CMyDlg::OnBtnCalendar()  method and it fixed the problem.


Posted By: Oleg
Date Posted: 19 September 2006 at 3:27pm
ok :)

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


Posted By: coffeeholic
Date Posted: 16 March 2010 at 1:03pm

Hello,

in my case I also get a crash in XTPGetTopLevelWndMsgNotifier()->Unadvise(this);
 
I am using the Code in an ActiveX Control in an MFC Application. The call of the date time picker itself is in one of our librarys.
 
What if I leave all code with Advise() and Unadvise() out of the toolkit? I don't have a crash then anymore, but what features are missing or is the Datetime Picker functionalty given anyway? (I does work in this case in a short test)
 
All help in this topic would be helpful.
 
I forgot to mention that I tried to use AFX_MANAGE_STATE in Control too, but it didn't solve the problem.



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