Solved

Navigating HTMLView from modal Dialog control

Posted on 2004-04-14
6
413 Views
Last Modified: 2013-11-20
Hi, experts!

I have  CMyHTMLView application and (CDisplayDlg) modal dialog, which pops up
from clicking on button in Docking ToolBar of CMyHTMLView.
CDisplayDlg makes some writing to "C:\\AAA_Text.txt" file a hard drive from user input.
Another button in Docking ToolBar brings "c:\\ReadDataTxt.htm,which displays the content of C:\\AAA_Text.txt in of CMyHTMLView.
I would like to be able to bring "c:\\ReadDataTxt.htm" into  CMyHTMLView by clicking a button on my modal dialog(CDisplayDlg), which would allow me to view the results of input and edit them before CDisplayDlg is destroyed.
All my attempts to get a pointer to CHTMLView from CDisplayDlg in order to invoke
Navigate(....) are resulting in assertion failure.
Maybe i have to use different View architecture for my task.

Plaese, advise. Thank you very much.
Code snippet is appreciated.
 
0
Comment
Question by:khlauster
  • 2
  • 2
6 Comments
 
LVL 4

Expert Comment

by:caner_elci
ID: 10827756
use Navigate2(), it's supposed to work well.. if you have any assertion failure, please post your calling line and asserting message...
0
 

Author Comment

by:khlauster
ID: 10830362
Hi,

The calling line from DisplayDlg.cpp is:

void CDisplayDlg::OnView()
{
      
      CFile file;
      file.Open(_T("c:\\ReadDataTxt.htm"), CFile::modeReadWrite);

      CHtmlView * pTestRE = (CHtmlView *) CWnd::GetOwner();
      pTestRE->Navigate2(_T("c:\\ReadDataTxt.htm"),NULL,NULL);

}

Which produce: "Unhandled exeption in CMyHTML.exe {MFC42.DLL}:0xC0000005:
                         Access Violation"

Thank you for your help
0
 
LVL 4

Accepted Solution

by:
caner_elci earned 250 total points
ID: 10830754
Well, there you open the file for reading and writing (that's file gets in use) and afterwards you try to access that file by navigating to it.. Why do you open the file? Can you try without that lines? Like:

void CDisplayDlg::OnView()
{
//     CFile file;
//     file.Open(_T("c:\\ReadDataTxt.htm"), CFile::modeReadWrite);

     CHtmlView * pTestRE = (CHtmlView *) CWnd::GetOwner();
     pTestRE->Navigate2(_T("c:\\ReadDataTxt.htm"),NULL,NULL);
}

One more thing, what's your CDisplayDlg and how do you get a CHtmlView by getting its owner?

Last one, please check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vchowCreatingWebBrowserstyleApplication.asp for a article by Microsoft...
0
 

Author Comment

by:khlauster
ID: 10833304
I am sorry,

i just forgot to comment out the lines when posting my question
Still the same "Unhandled exeption in CMyHTML.exe {MFC42.DLL}:0xC0000005:
                         Access Violation"

CDisplayDlg is the class for modal pop up dialog, which  can be envoked from CMyHTMLView(my HTMLView application) .

Thank you, caner elci.

I am certainly going to read the article.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now