debug assertion failed - what are the causes of this error?
- the code for the dll is same as the other projects but in others i don't get this error but in one project iam getting this error..
-
if ( m_wndSplitter.CreateView(nRow, nCol, n_pViewClass, CSize(0, 0), &context) == FALSE )
{
TRACE( "Failed to Create View\n" );
ASSERT(0);
return NULL;
}
-after this if() statement in other projects it goes to he particular dll's showwindow() function ..but why it is not going in this case?
-all the parameters in the if() are getting valid values .
What I have tried:
#include "stdafx.h"
#include "..\main\CommonDlgRes.h"
#include "OutputContactRes.h"
#include "..\CommonDLLEx\CLabel.h"
#include "..\common\OfflinerCommon.h"
#include "c14OCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define MAX_LEN 12
IMPLEMENT_DYNCREATE(c14OCDlg, CFormView)
c14OCDlg::c14OCDlg()
: CFormView(c14OCDlg::IDD)
{
m_bInitialUpdate = FALSE;
m_pFrame = NULL;
}
c14OCDlg::~c14OCDlg()
{
}
void c14OCDlg::DoDataExchange(CDataExchange* pDX)
{
int MaxChars = MAX_LEN;
int i = 0;
CStringArray tmpOutputContact;
tmpOutputContact.SetSize(m_pOutContact->GetSize());
if ( pDX->m_bSaveAndValidate == TRUE )
{
for (i = 0; i < m_pOutContact->GetSize(); i++ )
tmpOutputContact[i] = m_pOutContact->GetAt(i);
}
try
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_STATIC_DEV_TITLE, m_lblTitle);
int iIndex = 0;
DDX_Text(pDX, EDIT_OUT1, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT2, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT3, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT4, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT5, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT6, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT7, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT8, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT9, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT10, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT11, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT12, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT13, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
iIndex++;
DDX_Text(pDX, EDIT_OUT14, (*m_pOutContact)[iIndex]);
DDV_MaxChars(pDX, (*m_pOutContact)[iIndex], MaxChars);
}
catch(...)
{
if ( pDX->m_bSaveAndValidate )
m_pOutContact->Copy(tmpOutputContact);
}
if ( pDX->m_bSaveAndValidate )
{
bool bChanged = false;
for (i = 0; i < m_pOutContact->GetSize(); i++ )
{
if ( tmpOutputContact[i] != (*m_pOutContact)[i] )
{
bChanged = true;
break;
}
}
if (bChanged)
GetDocument()->SetModifiedFlag( TRUE );
}
}
BEGIN_MESSAGE_MAP(c14OCDlg, CFormView)
ON_WM_SHOWWINDOW()
ON_BN_CLICKED(IDC_RETURN, OnReturnKeyPress)
ON_WM_CLOSE()
ON_WM_TIMER()
ON_EN_CHANGE(EDIT_OUT1, OnChange)
ON_EN_CHANGE(EDIT_OUT2, OnChange)
ON_EN_CHANGE(EDIT_OUT3, OnChange)
ON_EN_CHANGE(EDIT_OUT4, OnChange)
ON_EN_CHANGE(EDIT_OUT5, OnChange)
ON_EN_CHANGE(EDIT_OUT6, OnChange)
ON_EN_CHANGE(EDIT_OUT7, OnChange)
ON_EN_CHANGE(EDIT_OUT8, OnChange)
ON_EN_CHANGE(EDIT_OUT9, OnChange)
ON_EN_CHANGE(EDIT_OUT10, OnChange)
ON_EN_CHANGE(EDIT_OUT11, OnChange)
ON_EN_CHANGE(EDIT_OUT12, OnChange)
ON_EN_CHANGE(EDIT_OUT13, OnChange)
ON_EN_CHANGE(EDIT_OUT14, OnChange)
ON_EN_SETFOCUS(EDIT_OUT1, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT2, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT3, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT4, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT5, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT6, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT7, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT8, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT9, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT10, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT11, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT12, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT13, OnSetfocusOut)
ON_EN_SETFOCUS(EDIT_OUT14, OnSetfocusOut)
END_MESSAGE_MAP()
#ifdef _DEBUG
void c14OCDlg::AssertValid() const
{
CFormView::AssertValid();
}
void c14OCDlg::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
void c14OCDlg::GetData()
{
m_pFrame = GetParentFrame();
LRESULT lResult = 0;
lResult = m_pFrame->SendMessage(WM_GET_DATA, OUTPUT_CONTACTS);
m_pOutContact = (CStringArray *)lResult;
}
void c14OCDlg::OnInitialUpdate()
{
GetData();
CFormView::OnInitialUpdate();
m_bInitialUpdate = TRUE;
m_lblTitle.SetText("Output Contact Names");
m_lblTitle.SetFontBold(TRUE);
m_lblTitle.SetFontSize(CONST_TITLE_TEXT_SIZE);
}
void c14OCDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CFormView::OnShowWindow(bShow, nStatus);
if ( bShow == TRUE && m_bInitialUpdate == TRUE )
{
CWnd *wnd = GetDlgItem( EDIT_OUT1 );
wnd->SetFocus();
}
}
void c14OCDlg::OnReturnKeyPress()
{
PostMessage( WM_NEXTDLGCTL, 0, 0L);
}
void c14OCDlg::OnChange()
{
UpdateData(TRUE);
}
void c14OCDlg::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
if ( lHint == SAVING_FLAG_ )
UpdateData( TRUE );
else if ( lHint == LOADING_FLAG_)
UpdateData( FALSE );
else if ( lHint == UPDATE_FLAG_ )
{
GetData();
UpdateData( FALSE );
}
}
void c14OCDlg::OnClose()
{
m_bInitialUpdate = FALSE;
this->EnableWindow( FALSE );
this->ShowWindow( SW_HIDE );
CFormView::OnClose();
}
void c14OCDlg::OnSetfocusOut()
{
if ( m_pFrame )
{
sprintf(m_Tip.szLarge, "Enter up to %d characters for Output Contact name.", MAX_LEN);
m_pFrame->SendMessage(WM_SB_TIP, MSG_STRING, (LPARAM)&m_Tip.szLarge);
}
}
BOOL c14OCDlg::PreTranslateMessage(MSG* pMsg)
{
#if 1 //Check for special charector
HANDLE hCopyData;
char *szText;
CString szSpecial;
if( pMsg->wParam == 'V' )
{
if( IsCTRLpressed() )
{
if( OpenClipboard() )
{
hCopyData = GetClipboardData(CF_TEXT);
CloseClipboard();
szText = (char*)GlobalLock(hCopyData);
szSpecial = szText ;
for (int n = 0; n < szSpecial.GetLength(); n++)
{
UINT uiKey = unsigned int(szSpecial[n]);
if (!isdigit(szSpecial[n]) && CheckForSpecialChar(uiKey) )
return TRUE;
}
}
}
}
if ( pMsg->message == WM_CHAR )
{
return CheckForSpecialChar((unsigned int ( pMsg->wParam )));
}
#endif
return CFormView::PreTranslateMessage(pMsg);
}