Click here to Skip to main content
15,888,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHelp Pls - C++ and ADO problem Pin
antonaras30-May-06 5:39
antonaras30-May-06 5:39 
AnswerRe: Help Pls - C++ and ADO problem Pin
Steve S30-May-06 6:10
Steve S30-May-06 6:10 
GeneralRe: Help Pls - C++ and ADO problem Pin
antonaras30-May-06 6:25
antonaras30-May-06 6:25 
GeneralRe: Help Pls - C++ and ADO problem Pin
Steve S30-May-06 6:37
Steve S30-May-06 6:37 
GeneralRe: Help Pls - C++ and ADO problem Pin
antonaras30-May-06 6:50
antonaras30-May-06 6:50 
GeneralRe: Help Pls - C++ and ADO problem Pin
Jörgen Sigvardsson30-May-06 13:32
Jörgen Sigvardsson30-May-06 13:32 
GeneralRe: Help Pls - C++ and ADO problem Pin
Steve S30-May-06 22:24
Steve S30-May-06 22:24 
QuestionBeginner MFC Dialog Problems Pin
aei_totten30-May-06 5:32
aei_totten30-May-06 5:32 
Hey, I have been programming c++ for 4-5 years now (my real love is Java), but I am trying to make an mfc project (VS 2005) for the first time.

I went through the wizard and then made some extra dialog boxes making sure to name all of the compnents(dropdown boxes, textboxes, etc). Now I am trying to connect the dialog boxes and I am having some problems.
I have tried looking at some tutorials online, but am still having some problems.

I am trying to create a dialog box (Main_DIALOG) when "ok" is clicked on in the orginal box (LogOn_DIALOG).

Here is what I have now:

I know this is a lot of code to look at, but I really don't know where the problem is. The wizard wrrote most of the code and I am freaking hating that.

-----------------------------------------------------------
#pragma once

// CMyLogOnDialog dialog

class CMyLogOnDialog : public CDialog
{
	DECLARE_DYNAMIC(CMyLogOnDialog)

public:
	CMyLogOnDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~CMyLogOnDialog();

// Dialog Data
	enum { IDD = LogOn_DIALOG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedButton();
};

----------------------------------------
#pragma once


// CMyMainDialog dialog

class CMyMainDialog : public CDialog
{
	DECLARE_DYNAMIC(CMyMainDialog)

public:
	CMyMainDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~CMyMainDialog();

// Dialog Data
	enum { IDD = Main_DIALOG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
};

-------------------------------------------------
// MyLogOnDialog.cpp : implementation file
//

#include "stdafx.h"
#include "ECO.h"
#include "MyLogOnDialog.h"
#include "MyMainDialog.h"


// CMyLogOnDialog dialog

IMPLEMENT_DYNAMIC(CMyLogOnDialog, CDialog)

CMyLogOnDialog::CMyLogOnDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CMyLogOnDialog::IDD, pParent)
{

}

CMyLogOnDialog::~CMyLogOnDialog()
{
}

void CMyLogOnDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CMyLogOnDialog, CDialog)
	ON_BN_CLICKED(LogOnOK_Button, &CMyLogOnDialog::OnBnClickedButton)
END_MESSAGE_MAP()


// CMyLogOnDialog message handlers

void CMyLogOnDialog::OnBnClickedButton()
{
	// TODO: Add your control notification handler code here
	CMyMainDialog dlg;
   dlg.DoModal();
}
 
----------------------------------------------
// MyMainDialog.cpp : implementation file
//

#include "stdafx.h"
#include "ECO.h"
#include "MyMainDialog.h"


// CMyMainDialog dialog

IMPLEMENT_DYNAMIC(CMyMainDialog, CDialog)

CMyMainDialog::CMyMainDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CMyMainDialog::IDD, pParent)
{

}

CMyMainDialog::~CMyMainDialog()
{
}

void CMyMainDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CMyMainDialog, CDialog)
END_MESSAGE_MAP()
----------------------------------------------------

I don't get any error messages, but my second window doesn't popup. Did I put my action handler in the wrong class? Or am I just totally off here?

I am sorry for asking such a stupid question, but I am really just not getting it which is weird considering how fast I picked up c++ and Java (witout any wizards).

Feeling Stupid,
Brandy
AnswerRe: Beginner MFC Dialog Problems Pin
Zac Howland30-May-06 5:48
Zac Howland30-May-06 5:48 
GeneralRe: Beginner MFC Dialog Problems Pin
aei_totten30-May-06 8:13
aei_totten30-May-06 8:13 
QuestionRe: Beginner MFC Dialog Problems Pin
Hamid_RT30-May-06 8:44
Hamid_RT30-May-06 8:44 
AnswerRe: Beginner MFC Dialog Problems Pin
aei_totten30-May-06 9:14
aei_totten30-May-06 9:14 
GeneralRe: Beginner MFC Dialog Problems Pin
Eric Dahlvang30-May-06 9:14
Eric Dahlvang30-May-06 9:14 
GeneralRe: Beginner MFC Dialog Problems Pin
Zac Howland30-May-06 9:41
Zac Howland30-May-06 9:41 
QuestionRe: Beginner MFC Dialog Problems Pin
Roger Stoltz30-May-06 5:53
Roger Stoltz30-May-06 5:53 
QuestionPOP3 server source Pin
Arman S.30-May-06 5:30
Arman S.30-May-06 5:30 
QuestionHow to place an edit box and dialog box on a window in VC++ dot Net Pin
Ashutosh Bagaria30-May-06 5:28
Ashutosh Bagaria30-May-06 5:28 
AnswerRe: How to place an edit box and dialog box on a window in VC++ dot Net Pin
Chris Losinger30-May-06 6:11
professionalChris Losinger30-May-06 6:11 
QuestionResize based on screen resolution Pin
NYTSX30-May-06 4:33
NYTSX30-May-06 4:33 
AnswerRe: Resize based on screen resolution Pin
Zac Howland30-May-06 5:26
Zac Howland30-May-06 5:26 
AnswerRe: Resize based on screen resolution Pin
Hamid_RT30-May-06 7:55
Hamid_RT30-May-06 7:55 
AnswerRe: Resize based on screen resolution Pin
harilal31-May-06 0:42
harilal31-May-06 0:42 
QuestionReading physical memory Pin
aaaan30-May-06 2:30
aaaan30-May-06 2:30 
AnswerRe: Reading physical memory Pin
toxcct30-May-06 3:05
toxcct30-May-06 3:05 
AnswerRe: Reading physical memory Pin
Chris Losinger30-May-06 3:17
professionalChris Losinger30-May-06 3:17 

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.