Click here to Skip to main content
16,012,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Easter Date Calculation Egg Pin
Tim Deveaux21-Feb-01 8:03
Tim Deveaux21-Feb-01 8:03 
QuestionDetecting Internet Connection? Pin
TomK20-Feb-01 23:27
TomK20-Feb-01 23:27 
AnswerRe: Detecting Internet Connection? Pin
Paolo Messina21-Feb-01 7:35
professionalPaolo Messina21-Feb-01 7:35 
QuestionHow to create service in Windows 98 Pin
Puneet Jain20-Feb-01 22:23
Puneet Jain20-Feb-01 22:23 
GeneralTSR programming Pin
20-Feb-01 21:59
suss20-Feb-01 21:59 
GeneralRe: TSR programming Pin
l a u r e n20-Feb-01 23:06
l a u r e n20-Feb-01 23:06 
GeneralPassing data from Document to a Modal Dialog Pin
20-Feb-01 21:51
suss20-Feb-01 21:51 
GeneralRe: Passing data from Document to a Modal Dialog Pin
Christian Graus20-Feb-01 23:26
protectorChristian Graus20-Feb-01 23:26 
You need to declare a pointer to the document from your dialog class ( or I suppose you could pass it in the contructor, but what I am about to show you will be more generally useful, so here goes )

To get a pointer to your main window do something like this

CMainFrame* pMain = (CMainFrame*) AfxGetMainWnd();

then in an SDI app you can get the view like this:

CMpAppView* pView = (CMyAppView*) pMain->GetActiveView();

and the doc like this

CMyAppDoc* pDoc = (CMyAppDoc*) pView->GetDocument();

Of course, you may find you need to impliment get/set methods to your data, or declare your dialog to be a friend of your document class. Please don't take the cheap way and make all of your document data public, it is a poor design, even if it is quick 'n' dirty.

If your program is MDI, just insert MDIGetActive()-> before GetActiveView, the rest is the same. And for the sake of completeness, AfxGetApp() returns your CWinApp derived class ( don't forget to cast it ).


Christian

The content of this post is not necessarily the opinion of my yadda yadda yadda.

To understand recursion, we must first understand recursion.
GeneralScroll in CRichEditView Pin
LEE HO JUN20-Feb-01 21:49
LEE HO JUN20-Feb-01 21:49 
GeneralRe: Scroll in CRichEditView Pin
l a u r e n21-Feb-01 10:58
l a u r e n21-Feb-01 10:58 
GeneralRe: Scroll in CRichEditView Pin
LEE HO JUN21-Feb-01 14:01
LEE HO JUN21-Feb-01 14:01 
General%cpu usage per process on Win9x OS Pin
trilok_soni20-Feb-01 21:18
trilok_soni20-Feb-01 21:18 
GeneralWorking with IE Pin
Stefan Dahlin20-Feb-01 20:28
Stefan Dahlin20-Feb-01 20:28 
QuestionHow to get ip address & hostname? Pin
hahyojin20-Feb-01 20:08
hahyojin20-Feb-01 20:08 
AnswerRe: How to get ip address & hostname? Pin
Rene D20-Feb-01 20:16
Rene D20-Feb-01 20:16 
GeneralRe: How to get ip address & hostname? Pin
hahyojin20-Feb-01 20:38
hahyojin20-Feb-01 20:38 
GeneralRe: How to get ip address & hostname? Pin
Halid Niyaz25-Jan-02 2:41
Halid Niyaz25-Jan-02 2:41 
GeneralObject Orientated Nightmare Pin
Brendan Tregear20-Feb-01 14:03
Brendan Tregear20-Feb-01 14:03 
GeneralRe: Object Orientated Nightmare Pin
20-Feb-01 15:39
suss20-Feb-01 15:39 
GeneralRe: Object Orientated Nightmare Pin
l a u r e n20-Feb-01 23:13
l a u r e n20-Feb-01 23:13 
GeneralRe: Object Orientated Nightmare Pin
Erik Funkenbusch21-Feb-01 12:59
Erik Funkenbusch21-Feb-01 12:59 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:32
Mr Morden21-Feb-01 19:32 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:38
Mr Morden21-Feb-01 19:38 
GeneralCListBox Pin
Vickie20-Feb-01 7:52
Vickie20-Feb-01 7:52 
GeneralRe: CListBox Pin
20-Feb-01 8:12
suss20-Feb-01 8:12 

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.