Click here to Skip to main content
15,910,411 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: drag and drop images Pin
Nibu babu thomas5-Mar-06 20:58
Nibu babu thomas5-Mar-06 20:58 
GeneralRe: drag and drop images Pin
baldha rakesh5-Mar-06 21:38
baldha rakesh5-Mar-06 21:38 
Questionwhy was my dllmain() not called? Pin
derek75-Mar-06 20:42
derek75-Mar-06 20:42 
AnswerRe: why was my dllmain() not called? Pin
Nibu babu thomas5-Mar-06 21:01
Nibu babu thomas5-Mar-06 21:01 
Questionhow to insert static controls into the listbox Pin
kotiramkoteswararao5-Mar-06 20:14
kotiramkoteswararao5-Mar-06 20:14 
QuestionMFC - exchange data between two CFormView form Pin
pjmvn5-Mar-06 20:08
pjmvn5-Mar-06 20:08 
AnswerRe: MFC - exchange data between two CFormView form Pin
Nibu babu thomas5-Mar-06 20:27
Nibu babu thomas5-Mar-06 20:27 
GeneralRe: MFC - exchange data between two CFormView form Pin
pjmvn5-Mar-06 20:39
pjmvn5-Mar-06 20:39 
I have done that but not success, here is my code:
//FrmTrans.cpp
// FrmTrans.cpp : implementation file<br />
//<br />
#include "stdafx.h"<br />
#include "Test MFC.h"<br />
#include "ChildFrm.h"<br />
#include "MainFrm.h"<br />
#include "ChildFrm.h"<br />
#include "Test MFCDoc.h"<br />
#include "Test MFCView.h"<br />
#include "FrmTrans.h"<br />
#include "FrmReceive.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmTrans<br />
<br />
IMPLEMENT_DYNCREATE(FrmTrans, CFormView)<br />
<br />
FrmTrans::FrmTrans()<br />
	: CFormView(FrmTrans::IDD)<br />
{<br />
	//{{AFX_DATA_INIT(FrmTrans)<br />
		// NOTE: the ClassWizard will add member initialization here<br />
	//}}AFX_DATA_INIT<br />
}<br />
<br />
FrmTrans::~FrmTrans()<br />
{<br />
}<br />
<br />
void FrmTrans::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CFormView::DoDataExchange(pDX);<br />
	//{{AFX_DATA_MAP(FrmTrans)<br />
	DDX_Control(pDX, ID_txtTrans, txtTrans);<br />
	//}}AFX_DATA_MAP<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(FrmTrans, CFormView)<br />
	//{{AFX_MSG_MAP(FrmTrans)<br />
	ON_BN_CLICKED(ID_cmdTrans, OncmdTrans)<br />
	ON_BN_CLICKED(ID_cmdTest, OncmdTest)<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmTrans diagnostics<br />
<br />
#ifdef _DEBUG<br />
void FrmTrans::AssertValid() const<br />
{<br />
	CFormView::AssertValid();<br />
}<br />
<br />
void FrmTrans::Dump(CDumpContext& dc) const<br />
{<br />
	CFormView::Dump(dc);<br />
}<br />
#endif //_DEBUG<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmTrans message handlers<br />
<br />
//NOTE HERE ===================================<br />
FrmReceive* frmReceive;<br />
<br />
void FrmTrans::OncmdTrans() <br />
{<br />
	frmReceive=new FrmReceive();<br />
	CMultiDocTemplate* frm;<br />
	frm= new CMultiDocTemplate(<br />
		IDR_TESTMFTYPE,<br />
		RUNTIME_CLASS(CTestMFCDoc),<br />
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame<br />
		frmReceive->GetRuntimeClass());<br />
<br />
	CDocument* pDoc;<br />
	POSITION pos = frm->GetFirstDocPosition();<br />
	if (!pos){<br />
		pDoc = frm->OpenDocumentFile(NULL, TRUE);<br />
		pDoc->SetTitle("Form Trans");<br />
	}<br />
	else<br />
	{<br />
		pDoc = frm->GetNextDoc(pos);<br />
		pos	= pDoc->GetFirstViewPosition();<br />
		if (pos)<br />
		{<br />
			CView* pView = pDoc->GetNextView(pos);<br />
			CFrameWnd *pFrame = pView->GetParentFrame();<br />
			if (pFrame)<br />
				pFrame->ActivateFrame();<br />
		}<br />
	}<br />
<br />
	frmReceive->SetParrentForm(this);<br />
	<br />
	CString temp;<br />
	GetDlgItemText(ID_txtTrans, temp);<br />
	frmReceive->SetTextValue(temp);<br />
}<br />
<br />
void FrmTrans::OncmdTest() <br />
{	<br />
	CString temp;<br />
	temp.Format("%u", frmReceive->parrentForm);<br />
	AfxMessageBox(temp);<br />
}<br />


Here is Receive form.
// FrmReceive.cpp : implementation file<br />
//<br />
// in FrmReceive.h have two attributes<br />
// FrmTrans* parrentForm<br />
// and CString text<br />
///================<br />
<br />
#include "stdafx.h"<br />
#include "Test MFC.h"<br />
#include "FrmReceive.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmReceive<br />
<br />
IMPLEMENT_DYNCREATE(FrmReceive, CFormView)<br />
<br />
FrmReceive::FrmReceive()<br />
	: CFormView(FrmReceive::IDD)<br />
{}<br />
<br />
FrmReceive::~FrmReceive()<br />
{}<br />
<br />
void FrmReceive::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CFormView::DoDataExchange(pDX);<br />
	//{{AFX_DATA_MAP(FrmReceive)<br />
	DDX_Control(pDX, ID_txtReceive, txtReceive);<br />
	//}}AFX_DATA_MAP<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(FrmReceive, CFormView)<br />
	//{{AFX_MSG_MAP(FrmReceive)<br />
	ON_BN_CLICKED(ID_cmdReceive, OncmdReceive)<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmReceive diagnostics<br />
<br />
#ifdef _DEBUG<br />
void FrmReceive::AssertValid() const<br />
{<br />
	CFormView::AssertValid();<br />
}<br />
<br />
void FrmReceive::Dump(CDumpContext& dc) const<br />
{<br />
	CFormView::Dump(dc);<br />
}<br />
#endif //_DEBUG<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// FrmReceive message handlers<br />
<br />
void FrmReceive::SetParrentForm(FrmTrans* parrentForm)<br />
{<br />
	this->parrentForm=parrentForm;<br />
	CString temp;<br />
//this message is true<br />
	temp.Format("%u", this->parrentForm);<br />
	AfxMessageBox(temp);<br />
}<br />
<br />
void FrmReceive::OncmdReceive() <br />
{<br />
	CString temp;<br />
	temp.Format("%u", this->parrentForm);<br />
//two message is wrong, .... ?????	<br />
	AfxMessageBox(temp);<br />
	AfxMessageBox(this->text);<br />
}<br />
<br />
void FrmReceive::SetTextValue(CString text)<br />
{	<br />
	this->text=text;<br />
}<br />
<br />
void FrmReceive::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) <br />
{	<br />
	CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView);<br />
}<br />
<br />
void FrmReceive::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) <br />
{	<br />
}<br />
<br />
void FrmReceive::OnInitialUpdate() <br />
{}<br />


When i click on the cmdReceive, the message box show the value diffrent with "the first" and this-text is null ("").

I don not know why ???
Please correct it for me.
Thanks very much


-- modified at 2:39 Monday 6th March, 2006
AnswerRe: MFC - exchange data between two CFormView form Pin
pjmvn6-Mar-06 13:54
pjmvn6-Mar-06 13:54 
QuestionHow to trap IE refresh in Activex Control Pin
tenali_gowda5-Mar-06 20:07
tenali_gowda5-Mar-06 20:07 
QuestionIs it error? why Pin
derek75-Mar-06 19:57
derek75-Mar-06 19:57 
AnswerRe: Is it error? why Pin
PJ Arends5-Mar-06 20:17
professionalPJ Arends5-Mar-06 20:17 
Questionhandle mouse input problem ???? Pin
leenmie5-Mar-06 19:45
leenmie5-Mar-06 19:45 
QuestionHow to know a app linke what libary? Pin
derek75-Mar-06 19:38
derek75-Mar-06 19:38 
QuestionDVD Database Pin
rhys1005-Mar-06 19:33
rhys1005-Mar-06 19:33 
QuestionCalculate network bandwidth Pin
sectumsempra5-Mar-06 19:14
sectumsempra5-Mar-06 19:14 
AnswerRe: Calculate network bandwidth Pin
Nibu babu thomas5-Mar-06 19:22
Nibu babu thomas5-Mar-06 19:22 
QuestionDebug in Itanium machnes. Pin
e_prabhu5-Mar-06 19:09
e_prabhu5-Mar-06 19:09 
AnswerRe: Debug in Itanium machnes. Pin
Maxwell Chen5-Mar-06 20:30
Maxwell Chen5-Mar-06 20:30 
Questionhow to show gif image on picture box Pin
baldha rakesh5-Mar-06 19:01
baldha rakesh5-Mar-06 19:01 
AnswerRe: how to show gif image on picture box Pin
baldha rakesh5-Mar-06 19:40
baldha rakesh5-Mar-06 19:40 
QuestionTabCtrl problem Pin
Ganesh_T5-Mar-06 18:17
Ganesh_T5-Mar-06 18:17 
Questionwhat's the use of this? Pin
not insane yet!5-Mar-06 17:48
not insane yet!5-Mar-06 17:48 
AnswerRe: what's the use of this? Pin
Nibu babu thomas5-Mar-06 18:12
Nibu babu thomas5-Mar-06 18:12 
AnswerRe: what's the use of this? Pin
Michael Dunn5-Mar-06 18:27
sitebuilderMichael Dunn5-Mar-06 18:27 

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.