Click here to Skip to main content
15,906,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: message passing bw 2 application Pin
Brian Hart10-Aug-00 7:19
Brian Hart10-Aug-00 7:19 
GeneralRe: message passing bw 2 application Pin
Blake Miller22-Aug-00 10:00
Blake Miller22-Aug-00 10:00 
Generalcom Pin
koteswara9-Aug-00 19:48
koteswara9-Aug-00 19:48 
GeneralRe: com Pin
Brian Hart10-Aug-00 7:17
Brian Hart10-Aug-00 7:17 
GeneralRe: com Pin
Alex Gorev10-Aug-00 7:44
Alex Gorev10-Aug-00 7:44 
GeneralDCOM Tutorial Announcement Pin
Brian Hart9-Aug-00 14:43
Brian Hart9-Aug-00 14:43 
GeneralGetting the pointer to a CView from CMyApp Pin
David Wulff9-Aug-00 13:51
David Wulff9-Aug-00 13:51 
GeneralRe: Getting the pointer to a CView from CMyApp Pin
Brian Hart9-Aug-00 14:50
Brian Hart9-Aug-00 14:50 
An approach is, instead of the app getting pointers to the views, how about the views giving the app pointers back to themselves?

Add two public member variables to CMyApp, and #include lines, like this:

#include "View1.h"
#include "View2.h"

class CMyApp : public CWinApp
{
...

public:
CView1* m_pView1;
CView2* m_pView2;
}

// IN MYAPP.CPP

CMyApp::CMyApp()
{
// Initialize view pointers to NULL
m_pView1 = NULL;
m_pView2 = NULL;
}

void CMyApp::SetView1FromView2()
{
if (m_pView1 == NULL || m_pView2 == NULL)
return;

m_pView1->SetText(m_pView2->GetText());
}

// NOW IN View1.cpp

CView1::~CView1()
{
theApp.m_pView1 = NULL;
}

void CView1::OnInitialUpdate()
{
CView::OnInitialUpdate();

...

theApp.m_pView1 = this;
}

// AND IN View2.cpp

CView2::~CView2()
{
theApp.m_pView2 = NULL;
}

...

void CView2::OnInitialUpdate()
{
CView::OnInitialUpdate();

...

theApp.m_pView2 = this;
}

And voila! Smile | :)

Cheers,
Brian
GeneralRe: Getting the pointer to a CView from CMyApp Pin
David Wulff9-Aug-00 15:05
David Wulff9-Aug-00 15:05 
GeneralModify Windows Icons Pin
beka9-Aug-00 11:58
beka9-Aug-00 11:58 
GeneralSplitterWnd problem (Size of views !!!) Pin
Thomas Horak9-Aug-00 1:46
Thomas Horak9-Aug-00 1:46 
General****** Please HELP! File & SQL ****** Pin
Steve Lai9-Aug-00 1:00
Steve Lai9-Aug-00 1:00 
GeneralRe: ****** Please HELP! File & SQL ****** Pin
HP9-Aug-00 20:20
HP9-Aug-00 20:20 
GeneralCalling NT Service Pin
aasher8-Aug-00 18:54
aasher8-Aug-00 18:54 
GeneralRe: Calling NT Service Pin
HP9-Aug-00 0:08
HP9-Aug-00 0:08 
QuestionTransparent owner-drawn button? Pin
trey8-Aug-00 17:05
trey8-Aug-00 17:05 
AnswerRe: Transparent owner-drawn button? Pin
Paolo Messina8-Aug-00 21:29
professionalPaolo Messina8-Aug-00 21:29 
GeneralCatching a Keystroke Pin
sho98-Aug-00 15:16
sho98-Aug-00 15:16 
GeneralRe: Catching a Keystroke Pin
HP9-Aug-00 0:20
HP9-Aug-00 0:20 
Generaladding bitmaps to ctoolbar Pin
Shekhar8-Aug-00 10:38
Shekhar8-Aug-00 10:38 
GeneralSmall caption windows on Win2000 Pin
Paolo Messina8-Aug-00 7:00
professionalPaolo Messina8-Aug-00 7:00 
GeneralPrinting Bitmaps on a postscript printer Pin
Member 239698-Aug-00 4:59
Member 239698-Aug-00 4:59 
GeneralFinding out whether DHCP is enabled Pin
Paul Cole8-Aug-00 4:30
Paul Cole8-Aug-00 4:30 
GeneralUDP Packet Creation???? - H E L P ! ! ! Pin
daniel madden8-Aug-00 2:50
daniel madden8-Aug-00 2:50 
Generalanti-aliasing algorithm Pin
junsung kim8-Aug-00 1:47
sussjunsung kim8-Aug-00 1:47 

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.