?
Solved

Displaying an html file in CDHtmlDialog

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
Integration Management Part 2
Suggested Courses

755 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