Solved

CANNOT get active document from a dialog box

Posted on 1997-04-16
5
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

635 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