Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Displaying an html file in CDHtmlDialog

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

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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