?
Solved

Displaying an html file in CDHtmlDialog

Posted on 2007-04-07
4
Medium Priority
?
2,003 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 2000 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

765 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