Creating an HTML ResourceCreating an HTML Resource*
*Contents  *Index  *Topic Contents
*Previous Topic: SHOWHTMLDIALOGFN
*Next Topic: Reusing the WebBrowser Control

Creating an HTML Resource

Rather than distribute separate HTML files for your application's use, you can add the raw HTML to your application as a resource. You can then retrieve the HTML from your application when it is needed. ShowHTMLDialog is one example of how HTML can be used from a resource by using the res: protocol.

To add the HTML as a resource, you include a file that contains nothing but the actual HTML in your application's resource script. This file is included as an HTML type resource. The following example shows how to include a file called MyHTML.htm as an HTML resource.

HTML_RESOURCE HTML "MyHTML.htm"

In this example, "HTML_RESOURCE" is the identifier of the resource. This can be either a string or a numerical identifier. "HTML" is the resource type. Visual C++ 5.0 will interpret this as the numeric value 23 and will substitute 23 for "HTML" when the resource file is opened for editing. "MyHTML.htm" is the file that contains the HTML source that will be added. The resource compiler adds this file as is and will not attempt to interpret the contents of the file.

You can specify the HTML resource in any function that will accept a res: protocol. ShowHTMLDialog is one example of how HTML can be used from a resource by using the res: protocol. You can also use FindResource and LoadResource to obtain the HTML resource. In FindResource, specify the RT_HTML value for lpType to find an HTML resource.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.