Solved

CANNOT get active document from a dialog box

Posted on 1997-04-16
5
271 Views
Last Modified: 2013-11-20
I want to connect a recordset to a dialog, but I failed to get the active document.  The code is as follows:

BOOL CPlotDialog::OnInitDialog()
{
   CFyp1Doc * pDoc = (CFyp1Doc *)            GetParentFrame()->GetActiveDocument());
   m_pDialogSet = &(pDoc->m_dialogSet);
   m_pDialogSet->Open();
   CDialog::OnInitDialog();
}

/////////////////////////////////////////////

GetParentFrame() is successful, but GetActiveDocument() returns NULL.... so program terminates with error...

Tons of Thanks!!
0
Comment
Question by:chma4
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
serge010697 earned 50 total points
ID: 1301035
Try the following code:
((CFrameWnd*)AfxGetMainWnd())->GetActiveDocument()
0
 

Author Comment

by:chma4
ID: 1301036
Sorry, still get the NULL pointer... any more suggestion?
0
 
LVL 1

Expert Comment

by:serge010697
ID: 1301037
Sorry, that was my fault, this one should work:

((CFrameWnd*)AfxGetMainWnd())->GetActiveFrame()->GetActiveDocument();
0
 
LVL 1

Expert Comment

by:serge010697
ID: 1301038
Sorry, that was my fault, this one should work:

((CFrameWnd*)AfxGetMainWnd())->GetActiveFrame()->GetActiveDocument();
0
 

Author Comment

by:chma4
ID: 1301039
serge, Tons of Thanks !!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 98
Separate files macro - Errors on larger data set 18 73
java ^ examples 8 70
How to convert MFC::CString to UTF8 wchar_t* 10 387
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question