Solved

Displaying an html file in CDHtmlDialog

Posted on 2007-04-07
4
1,898 Views
Last Modified: 2013-11-20
Hi,

I want to use CDHtmlDialog to display a webpage in a dialog. I just want to do the following:

     m_MyDHtmlDialog.SetWebPage("C:\\some_html_file.html");

can someone give me a quick example of how to do that? I don't need any interaction or anything besides just display the page on the local disk.

Thanks
0
Comment
Question by:DJ_AM_Juicebox
[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
4 Comments
 

Author Comment

by:DJ_AM_Juicebox
ID: 18869477
Well since I have an MDI app I just tried deriving from CHtmlView and it looks really easy you just call:

    Navigate2(...);

but what's the difference between CHtmlView, CEditHtmlView, and CDHtmlDialog?

Thanks
0
 
LVL 9

Accepted Solution

by:
Priyesh earned 500 total points
ID: 18870145
CHTMLView is basically the WebBrowser control on an MFC View which fits into the doc/view architecture so you could use it just like you did on an MDI app as one of the views.

I havent used CHTMLEditView so my msdn is as good as yours on that one.

CDHTMLDialog lets you create a dialog using an HTML resource as opposed to a normal windows dialog resource. This has the added advantage of using the DDX_DHTML macros for data binding to and from your controls just like you would with a normal dialog.
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 18870164
Ok, one other question with it.

Is there a way to have it display html from a stream rather than a web address? Right now it looks like you can only call:

    Navigate("some_page.html");

is there a way instead to feed it an html stream? Something like:

     stringstream ss;
     ss << "<html><p>hello</p></html>";

     Navigate(ss.str().c_str());

It would be ideal to not have to keep writing the html I want it to parse and display to disk everytime.

thanks
0
 
LVL 9

Expert Comment

by:Priyesh
ID: 18873056
I know you can do this with CDHTMLDialog. Look up the MSDN sample for it here: http://msdn2.microsoft.com/zh-cn/library/cca2a89k(VS.80).aspx

The area where your files are displayed is dynamically built and applied to the webbrowser. Checking that code might show you a way to do this in CHTMLView as well. It seems like you can apply the same technique in your CHTMLView.
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
format the code in java 6 110
java ^ examples 8 70
tripleUp challenge 7 93
Problem to App 4 120
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 …
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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