Click here to Skip to main content
15,889,811 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: where should add the try-catch? Pin
TinyDevices13-May-12 20:59
professionalTinyDevices13-May-12 20:59 
GeneralRe: where should add the try-catch? Pin
yu-jian13-May-12 22:24
yu-jian13-May-12 22:24 
AnswerRe: where should add the try-catch? Pin
Aescleal14-May-12 3:15
Aescleal14-May-12 3:15 
QuestionNeed Help with Audio Output in C/C++ Pin
Veeshal Beotra13-May-12 4:12
Veeshal Beotra13-May-12 4:12 
AnswerRe: Need Help with Audio Output in C/C++ Pin
Vaclav_14-May-12 8:35
Vaclav_14-May-12 8:35 
QuestionChanging the background color of Text control or combo box when text got changed Pin
Ashish Ranjan Mishra13-May-12 4:01
Ashish Ranjan Mishra13-May-12 4:01 
AnswerRe: Changing the background color of Text control or combo box when text got changed Pin
«_Superman_»13-May-12 4:12
professional«_Superman_»13-May-12 4:12 
Question'Forward Class Declaration' Not Working Pin
AmbiguousName12-May-12 20:44
AmbiguousName12-May-12 20:44 
hello guys... I am having a debug assertion when trying to use forward class declaration. Basically I have this CMyTabCtrl inwhich I have forward declared two dialog class, like this:

CMyTabCtrl.h
C++
class	CTabOneDlg;
class	CTabTwoDlg;


And now in the implementaion file, I am using these pointers to create instances of two dialogs and add them to the TabCtrl.
Here are the constructor and the InitializeTabs() functions.

CMyTabCtrl.cpp
CMyTabCtrl::CMyTabCtrl()
{
   m_arrTabs[0] = new CTabOneDlg; //CDialog* m_arrTabs[2];
   m_arrTabs[1] = new CTabTwoDlg;

   m_tabOne = (CTabOneDlg*)m_arrTabs[0]; // CTabOneDlg* m_tabOne; 
   m_tabTwo = (CTabTwoDlg*)m_arrTabs[1]; // CTabTwoDlg* m_tabTwo; 
}

coid CMyTabCtrl::InitializeTabs()
{
	this->InsertItem(0, _T("Faculty"));
	this->InsertItem(1, _T("Admin"));

	//create the dialogs
	m_arrTabs[0]->Create(IDD_TAB1_DLG, this);
	m_arrTabs[1]->Create(IDD_TAB2_DLG, this);

	//show the firs and hide the rest
	m_arrTabs[0]->ShowWindow(SW_SHOW);
	m_arrTabs[1]->ShowWindow(SW_HIDE);
}


And finally when in MainDialogDlg.cpp, I try to forward declare this CMyTabCtrl class, it gives debug assertion on the second line of the InitializeTabs() function.

CMainDialogDlg.h
C++
class CMyTabCtrl;

CMyTabCtrl *tabCtrl;


CMainDialogDlg.cpp
C++
BOOL CMainDialogDlg::OnInitDialog()
{
    tabCtrl = new CMyTabCtrl;
    tabCtrl->InitizlizeTabs();
}

The debug assertion it gives is as follows
mfc100ud.dll!CTabCtrl::InsertItem(int nItem, const wchar_t * lpszItem)  Line 570 + 0x2d bytes	C++


Why it is giving debug assertion on the InsertItem() function in the InitializeTabs() function. Thanks for at least giving time to read it.

This world is going to explode due to international politics, SOON.

QuestionRe: 'Forward Class Declaration' Not Working Pin
«_Superman_»12-May-12 20:53
professional«_Superman_»12-May-12 20:53 
AnswerRe: 'Forward Class Declaration' Not Working Pin
AmbiguousName12-May-12 22:23
AmbiguousName12-May-12 22:23 
AnswerRe: 'Forward Class Declaration' Not Working Pin
Richard MacCutchan12-May-12 21:30
mveRichard MacCutchan12-May-12 21:30 
GeneralRe: 'Forward Class Declaration' Not Working Pin
AmbiguousName12-May-12 22:29
AmbiguousName12-May-12 22:29 
GeneralRe: 'Forward Class Declaration' Not Working Pin
Richard MacCutchan12-May-12 22:34
mveRichard MacCutchan12-May-12 22:34 
AnswerRe: 'Forward Class Declaration' Not Working Pin
AmbiguousName12-May-12 22:56
AmbiguousName12-May-12 22:56 
GeneralRe: 'Forward Class Declaration' Not Working Pin
Richard MacCutchan13-May-12 1:18
mveRichard MacCutchan13-May-12 1:18 
AnswerRe: 'Forward Class Declaration' Not Working Pin
krmed13-May-12 3:34
krmed13-May-12 3:34 
GeneralRe: 'Forward Class Declaration' Not Working Pin
Richard MacCutchan13-May-12 5:04
mveRichard MacCutchan13-May-12 5:04 
GeneralRe: 'Forward Class Declaration' Not Working Pin
AmbiguousName13-May-12 6:59
AmbiguousName13-May-12 6:59 
QuestionSubclass Procedure failed for edit control Pin
vishalgpt12-May-12 3:09
vishalgpt12-May-12 3:09 
AnswerRe: Subclass Procedure failed for edit control Pin
«_Superman_»12-May-12 4:25
professional«_Superman_»12-May-12 4:25 
GeneralRe: Subclass Procedure failed for edit control Pin
vishalgpt12-May-12 4:40
vishalgpt12-May-12 4:40 
GeneralRe: Subclass Procedure failed for edit control Pin
«_Superman_»12-May-12 4:47
professional«_Superman_»12-May-12 4:47 
GeneralRe: Subclass Procedure failed for edit control Pin
vishalgpt12-May-12 5:36
vishalgpt12-May-12 5:36 
QuestionOpening files in c++ Pin
Jirik60727713612-May-12 2:38
Jirik60727713612-May-12 2:38 
AnswerRe: Opening files in c++ Pin
Richard MacCutchan12-May-12 2:51
mveRichard MacCutchan12-May-12 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.