Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Document pointer to use by modal dialog

Status
Not open for further replies.

leinad49

Programmer
Aug 29, 2002
11
ES
Hello!!

I have in my application one modal dialog that has to use the stored data in the Document object. Then I don't know how to get that pointer to access its data from dialog.

Please if anyone can help I will appreciate!!!

THANKS IN ADVANVE
 
You can pass it in the constructor of the dialog class.
Greetings,
Rick
 
Ok, by how to get the pointer to Document object. The owner window of that dialog is CMainFrame, no? I can't use GetDocument() directly...
 

At last I'm using a pointer defined in dialog class that is pointing to a document object. Then before call DoModal() function the View pass the value to the initiated dialog.
 
Just include the header of your document class in the header of your dialog class. It doesn't matter who "owns" the document, if you have a pointer to the class you can pass it to anyone you want to.
Greetings,
Rick
 
As I remember in MFC applications you can use functions getDocument or GetDocument, I do not remember exactly. Ion Filipski
1c.bmp


filipski@excite.com
 
To get the active document:
Code:
    CFrameWnd *pMainFrame = DYNAMIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
    CFrameWnd *pActiveFrame = pMainFrame->GetActiveFrame();
    if (pActiveFrame == NULL)
        return NULL;

    return pActiveFrame->GetActiveDocument();

HTH
Shyan
 
leinad:

Ok try the following:

CxxxxxDoc* pDoc = GetDocument();
pDoc->(object, e.g. m_StockPriceSet);

where xxxx is the name of the class you derived from MFC CDocument class,

Regards,

Ricardo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top