Click here to Skip to main content
15,908,776 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: System-Wide WriteProcessMemory Hook Pin
Stephen Hewitt19-Jul-06 15:22
Stephen Hewitt19-Jul-06 15:22 
GeneralPreventing the C++ compiler to optimize [solved] [modified] Pin
Jörgen Sigvardsson19-Jul-06 13:14
Jörgen Sigvardsson19-Jul-06 13:14 
QuestionFailed to invoke web services in VC++, please help [modified] Pin
Liu Shuai19-Jul-06 11:38
Liu Shuai19-Jul-06 11:38 
AnswerRe: Failed to invoke web services in VC++, please help Pin
kapil_moondra5-Jan-09 1:25
kapil_moondra5-Jan-09 1:25 
QuestionI hate imagelists!! ( drawing with ILD_TRANSPARENT ) [modified] Pin
Maximilien19-Jul-06 11:23
Maximilien19-Jul-06 11:23 
AnswerRe: I hate imagelists!! ( drawing with ILD_TRANSPARENT ) Pin
led mike19-Jul-06 11:40
led mike19-Jul-06 11:40 
GeneralRe: I hate imagelists!! ( drawing with ILD_TRANSPARENT ) Pin
Maximilien19-Jul-06 14:41
Maximilien19-Jul-06 14:41 
AnswerRe: I hate imagelists!! ( drawing with ILD_TRANSPARENT ) Pin
Michael Dunn19-Jul-06 16:15
sitebuilderMichael Dunn19-Jul-06 16:15 
QuestionIs the microphone in use? Pin
Larsson19-Jul-06 10:35
Larsson19-Jul-06 10:35 
QuestionRe: Is the microphone in use? [modified] Pin
Ali Rafiee19-Jul-06 10:52
Ali Rafiee19-Jul-06 10:52 
QuestionHow can I select a node in a treeview Pin
Alex Cutovoi19-Jul-06 9:08
Alex Cutovoi19-Jul-06 9:08 
AnswerRe: How can I select a node in a treeview Pin
Ali Rafiee19-Jul-06 9:21
Ali Rafiee19-Jul-06 9:21 
GeneralRe: How can I select a node in a treeview [modified] Pin
Alex Cutovoi19-Jul-06 11:18
Alex Cutovoi19-Jul-06 11:18 
GeneralRe: How can I select a node in a treeview Pin
Ali Rafiee19-Jul-06 11:23
Ali Rafiee19-Jul-06 11:23 
GeneralRe: How can I select a node in a treeview Pin
Alex Cutovoi20-Jul-06 2:24
Alex Cutovoi20-Jul-06 2:24 
QuestionSerial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 8:40
dinesh_pam19-Jul-06 8:40 
QuestionRe: Serial Communication with a Garmin Device Pin
cppcook19-Jul-06 9:02
cppcook19-Jul-06 9:02 
AnswerRe: Serial Communication with a Garmin Device Pin
kitty519-Jul-06 9:11
kitty519-Jul-06 9:11 
GeneralRe: Serial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 9:29
dinesh_pam19-Jul-06 9:29 
GeneralRe: Serial Communication with a Garmin Device Pin
kitty519-Jul-06 9:45
kitty519-Jul-06 9:45 
GeneralRe: Serial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 10:06
dinesh_pam19-Jul-06 10:06 
AnswerRe: Serial Communication with a Garmin Device Pin
led mike19-Jul-06 10:33
led mike19-Jul-06 10:33 
QuestionDialog Box DDX problem Pin
kitty519-Jul-06 8:13
kitty519-Jul-06 8:13 
Background:
I first created an MDI MFC application called test.

I then created a dialog named: IDD_MANUAL_CDIN.
This does simple data exchange:
User inputs a string in edit box1 (i.e. hello).
User clicks on "SEND" button.
User should see in edit box2 "I typed: hello".

I then created a class for that dialog which is implemented in manual.cpp:
<br />
#include "stdafx.h"<br />
#include "test.h"<br />
#include "manual.h"<br />
<br />
// manual dialog<br />
IMPLEMENT_DYNAMIC(manual, CDialog)<br />
<br />
manual::manual(CWnd* pParent /*=NULL*/)<br />
	: CDialog(manual::IDD, pParent)<br />
	, m_nIn(_T("init"))<br />
	, m_nSent(_T("I sent "))<br />
{}<br />
<br />
void manual::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CDialog::DoDataExchange(pDX);<br />
	DDX_Text(pDX, IDC_IN, m_nIn);<br />
	DDX_Text(pDX, IDC_SENT, m_nSent);<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(manual, CDialog)<br />
	ON_BN_CLICKED(IDC_BUTTON_SEND, &manual::OnButtonSend)<br />
END_MESSAGE_MAP()<br />
<br />
// App command to run the dialog<br />
void manual::OnManual()<br />
{<br />
	manual manualDlg;<br />
	manualDlg.DoModal();<br />
}<br />
// manual message handlers<br />
<br />
void manual::OnButtonSend()<br />
{<br />
	// TODO: Add your control notification handler code here<br />
	AfxMessageBox(tempSend); //DEBUG<br />
	AfxMessageBox(m_nIn); //DEBUG<br />
	m_nSent += m_nIn;<br />
}<br />

and manual.h:
<br />
class manual : public CDialog<br />
{<br />
	DECLARE_DYNAMIC(manual)<br />
<br />
public:<br />
	manual(CWnd* pParent = NULL);   // standard constructor<br />
	virtual ~manual();<br />
	afx_msg void OnManual();<br />
<br />
// Dialog Data<br />
	enum { IDD = IDD_MANUAL_CDIN };<br />
<br />
protected:<br />
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
public:<br />
	CString m_nIn;<br />
	CString m_nSent;<br />
	afx_msg void OnButtonSend();<br />
};<br />

I then changed the toolbar created by the MFC App wizard so that when you click one button it will open a dialog that corresponds to that button.
All this code is in the test.cpp file:
I do:
<br />
#include "manual.h"<br />
BEGIN_MESSAGE_MAP(CSpaceCubeDataRxApp, CWinApp)<br />
	ON_COMMAND(ID_MCD_INPUT, &manual::OnManual)<br />
	ON_COMMAND(ID_APP_ABOUT, &CtestApp::OnAppAbout)<br />
	// Standard file based document commands<br />
	ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
	ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
END_MESSAGE_MAP()<br />

Question:
After compiling I go to type in the string "hello" and click send and nothing pops up in edit box2. I know the "SEND" button function works b/c of the DEBUG AfxMessageBox the I put in it. Nothing is assigned to the variable m_nIn. The data exchange isn't working.

What am I missing?

Kitty5
AnswerRe: Dialog Box DDX problem Pin
Michael Dunn19-Jul-06 8:30
sitebuilderMichael Dunn19-Jul-06 8:30 
GeneralRe: Dialog Box DDX problem Pin
kitty519-Jul-06 8:32
kitty519-Jul-06 8:32 

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.