IE里能访问出HTML结果的DLL是怎么做的?
例如:
res://mshtml.dll/blank.htm

解决方案 »

  1.   

    你提到这个问题那我介绍一下res协议(在IE4以后支持)
    Res://协议是IE 4.0预定义的一个协议,它的基本语法res://resource file[/resourcetype]/resource id"
    其中resource file指的是含有资源的模块的文件名,请注意这里的路径分隔符只能使用“\”,而不能使用“/”。 Resourcetype是资源类型,它是一个字符串或数字。常用的资源类型都对应着一个数,比如BITMAP对应着RT_BITMAP=2,这些常数定义在VC++的WINUSER.H可以找到,如果资源类型是数字,要在数字前面加上“#”号。Resourcetype可以省略,默认为RT_HTML=23,即HTML文件。RT_HTML在VC++ 中没有定义,但现在已经广泛使用。 Resource id表示资源的ID号。在这里要注意一个问题:在VC++中定义资源的时候,通常是使用数字常量,比如ID_BITMAP1,它代表的数字可能是101。而在使用res://协议时,不能使用ID_BITMAP1(在DLL中并没有这个符号),而必须使用#101来代表资源。例如要显示一个位图资源,其ID号为101,应为res://mydll.dll/#2/#101。 
        如果在VC++制作的DLL中加入HTML资源文件,可以这样做:选择Import资源,然后选择一个HTML文件,当VC++提示资源类型时输入23(下图)。然后修改该属性的ID,例如"MYHTML.HTM"。这里的引号是必须输入的,如果不输入引号,VC++会指定一个数字给这个资源,调用的方法会有所不同。这样你可以使用res://mydll.dll/myhtml.htm来调用这个HTML文件。HTML文件中包含的图形文件也应该以这种方式插入。这是以VC为例说明的,详细你可以查看msdn的res Protocol
      

  2.   

    下面是我查到的资料,写出来供你参考:IntroductionWhen distributing an application that uses a web based interface or information pages you may not want your pages available to the end user.  The res: protocol allows you to embed your html and other objects into the resource file of an exe or dll file. 
    A good example of the res: protocol is "about:blank".  This is a blank embedded page.In developing the project it is probably wiser to work directly with the HTML files so that adjustments to layout can be made during the development process.  Once your interface and application work you can embed the files into a resource file - either using the VB 6 Resource Editor or the Resource Compiler (rc.exe - usually found in the '..Microsoft Visual Studio\Common\Vb\Resources' folder.You can include the Resource file in your project exe or have a separate ActiveX dll file.Format: res://path and filename[/resource type]/resource ID
     
    Path and filename: The path and file name of the EXE or DLL holding the resource. 
    Resource Type: [Optional] If the resource is a recognised Type (e.g. BITMAP) then the Type can be omitted.  If the resource is a custom resource (e.g. GIF) it should be labeled in the RC (resource compiler script file) and referenced in the res: information.  See the examples below. 
    Resource ID: This is the identifier of the resource in the resource file.  Often in the VB Resource Editor the first resource is 100 or 101.  If you have experience with defining names for resources you can use the definition term. The resource type and ID can be referenced as numbers.  The format then requires a # (hash) inserted before the number - however as hash is an 'HTML special character' an escape sequence should be used:  The escape sequence for # (hash) is %23.  This can make the path look complicated especially as the Resource Type value for HTML is 23.To load an HTML document from a resource file in Visual Basic use:WebBrowser.Navigate2 "res://myres.dll/%2323/%23101"Where 101 is the resource ID.The table below shows examples of referencing elements in a resource file within the HTML source code and how to add a reference to the information in the VB6 Resource editor.HTML Files 
    Type: 23 - this is the numerical value for the resource type HTML  
    HTML CODE: src="res://myresource.dll/%2323/%23101" 
     
    RC Definition: 101 HTML "C:\Example\index.htm" 
     
    VB 6 Resource Editor: Click the  'Add Custom' button, find the htm file and click 'Open'.  The resource will appear in a Folder named "CUSTOM" and will most likely be numbered 101.  Double click the resource and change 'CUSTOM' to 23 in the Type box.  Renumber the resource as required.  Click OK.  
    Bitmap Files 
    Type: 2 - this is the numerical value for the resource type BITMAP  
    HTML CODE: src="res://myresource.dll/%232/%23102" 
     
    RC Definition: 102 BITMAP "C:\Example\example.bmp" 
     
    VB 6 Resource Editor: Click the 'Add Bitmap' button, find the bmp file and click 'Open'.  The Resource Editor will place the resource in a Folder named "Bitmap".  Double click the resource to change its ID if required.  
    Custom Types - e.g. GIF and JPG Files 
    Type: GIF is a custom format, there is no equivalent numerical type.  Note that rather than a numerical reference in the HTML CODE, we state the custom format 'GIF'.  For Jpegs or other formats, replace 'GIF' with the chosen custom name.  
    HTML CODE: src="res://myresource.dll/GIF/%23103" 
     
    RC Definition: 103 GIF "C:\Example\picture.gif" 
     
    VB 6 Resource Editor: Click the  'Add Custom' button, find the GIF file and click 'Open'.  The resource will appear in a Folder named "CUSTOM".  Double click the resource and change the type from 'CUSTOM' to 'GIF'.  Renumber the resource as required.  Click OK.  他介绍的很详细