Solved

Navigating HTMLView from modal Dialog control

Posted on 2004-04-14
6
429 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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