Solved

Navigating HTMLView from modal Dialog control

Posted on 2004-04-14
6
421 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
Generic progress indicator 6 117
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 796
Expand macro to ask for filename column 8 37
Change to event 1 118
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

860 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