Solved

Navigating HTMLView from modal Dialog control

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 video discusses moving either the default database or any database to a new volume.

758 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

18 Experts available now in Live!

Get 1:1 Help Now