Click here to Skip to main content
15,798,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC dialog member sharing? (code included) Pin
monrobot134-Mar-04 6:39
monrobot134-Mar-04 6:39 
GeneralRe: MFC dialog member sharing? (code included) Pin
Christophocles4-Mar-04 6:49
sussChristophocles4-Mar-04 6:49 
GeneralRe: MFC dialog member sharing? (code included) Pin
BlackDice4-Mar-04 7:07
BlackDice4-Mar-04 7:07 
GeneralRe: MFC dialog member sharing? (code included) Pin
Christophocles4-Mar-04 8:06
sussChristophocles4-Mar-04 8:06 
GeneralRe: MFC dialog member sharing? (code included) Pin
BlackDice4-Mar-04 9:23
BlackDice4-Mar-04 9:23 
GeneralRe: MFC dialog member sharing? (code included) Pin
Christophocles4-Mar-04 10:14
sussChristophocles4-Mar-04 10:14 
GeneralRe: MFC dialog member sharing? (code included) Pin
BlackDice4-Mar-04 10:30
BlackDice4-Mar-04 10:30 
GeneralRe: MFC dialog member sharing? (code included) Pin
Christophocles4-Mar-04 11:27
sussChristophocles4-Mar-04 11:27 
Ok, I went over your code line-by-line and my problem was this:
I had commented-out the old "Standard Constructor" in Dlg2.h instead of leaving it as overloaded.

So now my code is like yours, Smile | :) and the program compiles fine, Hmmm | :| UNTIL...... Frown | :(

When I add my OnButton1() message handler in Dlg2.cpp, it doesn't recognize m_pDlg1.

When I try (in OnButton1()):
int nCurTabSel = m_pDlg1->m_tab.GetCurSel();
I get the error:
Dlg2.cpp(55) : error C2027: use of undefined type 'CDlg1'.

When I try:
m_pDlg1->function();
I get the error:
Dlg2.cpp(57) : error C2065: 'm_pDlg1' : undeclared identifier.

CTabCtrl m_tab & void function() are both defined under the "public:" section of the CDlg1 class.
I checked thoroughly for typos and found none. The message handler just doesn't seem to recognize m_pDlg1 even though it was just defined in the same Dlg2.cpp file:
CDlg2::CDlg2(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg2::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlg2)
	//}}AFX_DATA_INIT
}

CDlg2::CDlg2(CDlg1* pDlg, CWnd* pParent /*=NULL*/)
	: CDialog(CDlg2::IDD, pParent)
{
        m_pDlg1 = pDlg;
	//{{AFX_DATA_INIT(CDlg2)
	//}}AFX_DATA_INIT
}

void CDlg2::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlg2)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDlg2, CDialog)
	//{{AFX_MSG_MAP(CDlg2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlg2 message handlers

void CDlg2::OnButton1() 
{
        m_pDlg1->m_tab.GetCurSel(); // Doesn't work (error C2027)
        m_pDlg1->function();        // Doesn't work (error C2065)
}

I'm getting closer, I can feel it!!!! Big Grin | :-D
Thanks so much for your help.

-Chris
GeneralRe: MFC dialog member sharing? (code included) Pin
BlackDice5-Mar-04 4:49
BlackDice5-Mar-04 4:49 
GeneralRe: MFC dialog member sharing? (or, My Marathon Ineptitude) Pin
Christophocles5-Mar-04 5:41
sussChristophocles5-Mar-04 5:41 
GeneralRe: MFC dialog member sharing? (or My Enduring Ineptitude) Pin
Christophocles5-Mar-04 7:25
sussChristophocles5-Mar-04 7:25 
GeneralRe: MFC dialog member sharing? (or My Enduring Ineptitude) Pin
BlackDice5-Mar-04 11:43
BlackDice5-Mar-04 11:43 
GeneralRe: MFC dialog member sharing? Pin
Christophocles5-Mar-04 13:01
sussChristophocles5-Mar-04 13:01 
GeneralRe: MFC dialog member sharing? Pin
Christophocles8-Mar-04 9:01
sussChristophocles8-Mar-04 9:01 
GeneralAdvice required.... Pin
slyone3-Mar-04 11:54
slyone3-Mar-04 11:54 
GeneralRe: Advice required.... Pin
Roger Allen4-Mar-04 7:55
Roger Allen4-Mar-04 7:55 
GeneralRe: Advice required.... Pin
slyone4-Mar-04 13:02
slyone4-Mar-04 13:02 
GeneralUNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
cnd120013-Mar-04 11:36
cnd120013-Mar-04 11:36 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
Rick York3-Mar-04 12:09
mveRick York3-Mar-04 12:09 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
Tom Larsen3-Mar-04 12:23
Tom Larsen3-Mar-04 12:23 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
cnd120013-Mar-04 12:58
cnd120013-Mar-04 12:58 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
Christian Graus3-Mar-04 17:47
protectorChristian Graus3-Mar-04 17:47 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
Tom Larsen4-Mar-04 6:04
Tom Larsen4-Mar-04 6:04 
GeneralRe: UNWANTED DEBUG OF LIBRARY FUNCTIONS Pin
Jonas Larsson4-Mar-04 5:45
Jonas Larsson4-Mar-04 5:45 
GeneralAnti-Spam Project Pin
tempgp3-Mar-04 11:35
tempgp3-Mar-04 11:35 

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.