Solved

Displaying an html file in CDHtmlDialog

Posted on 2007-04-07
4
1,798 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 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

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

22 Experts available now in Live!

Get 1:1 Help Now