![]() |
CXTPDatePickerControl deconstructor causing assert |
Post Reply ![]() |
Author | |
Enclaved Shadow ![]() Groupie ![]() ![]() Joined: 22 August 2006 Location: Canada Status: Offline Points: 31 |
![]() ![]() ![]() ![]() ![]() 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:
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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
What Toolkit version? What VC version?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Enclaved Shadow ![]() Groupie ![]() ![]() Joined: 22 August 2006 Location: Canada Status: Offline Points: 31 |
![]() ![]() ![]() ![]() ![]() |
We're using ToolkitPro 10.2
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
I modified our DialogSample, added your code but don't see any problems.
please try it, do you see it on your computer?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Enclaved Shadow ![]() Groupie ![]() ![]() Joined: 22 August 2006 Location: Canada Status: Offline Points: 31 |
![]() ![]() ![]() ![]() ![]() |
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 \\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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, May be you can modify attached sample/add MFC extension to show problem?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Enclaved Shadow ![]() Groupie ![]() ![]() Joined: 22 August 2006 Location: Canada Status: Offline Points: 31 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
ok :)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
coffeeholic ![]() Newbie ![]() ![]() Joined: 16 March 2010 Location: Germany Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
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 |