IE浏览器控制res://用法 [英] IE web browser control res:// usage

查看:974
本文介绍了IE浏览器控制res://用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用IWebBrowser2控件,我有各种html文件作为资源存储在exe中。要加载这些我使用res://协议。问题是,在某些版本的IE的页面不再加载,而只是显示操作已取消,Internet Explorer无法链接到请求的页面。



.rc脚本中引用的页面如下:



stats.html HTML DISCARDABLEres\stats.html



res请求看起来像
res:// C:\path\To\MyApp.exe / stats.html



这用来工作很好,在某些时候这种行为改变了,大概是一个hot fix或类似的东西。现在,在我的机器上,它不工作。我已经尝试改变res路径看起来像:



res://MyApp.exe/stats.html



我尝试更改rc脚本:



stats HTML DISCARDABLE res\stats.html



和res路径:



res://MyApp.exe/ stats



现在可以了!但是这真的很烦人必须使用这种方式(从资源名称中删除。和文件扩展名)。有谁知道这是否是一个错误?功能?为什么会发生这种情况,还有另外一种方式?



编辑:
在玩了一些之后,我发现这个工作:
stats。 htm HTML DISCARDABLEres\stats.html
res://MyApp.exe/stats.htm



更改.html扩展名资源名称为.htm工程,但我不知道为什么!

解决方案

确保内容类型设置正确。确保HKEY_CLASSES_ROOT.html的内容类型设置为text / html,否则奇怪的事情发生。同上.htm。


I'm using the IWebBrowser2 control in my app and I have various html files that are stored as resources in the exe. To load these up I use the "res://" protocol. The problem is that with certain versions of IE the pages no longer load up, and instead just shows "Action Canceled, Internet Explorer was unable to link to the page requested."

The pages are referenced in the .rc script like so:

stats.html HTML DISCARDABLE "res\stats.html"

The res request looks like res://C:\path\To\MyApp.exe/stats.html

This used to work just fine, at some point this behavior changed, presumably with a hot fix or something like that. Now, on my machine, it doesn't work. I have tried altering the res path to look like:

res://MyApp.exe/stats.html

that didn't work.

I then tried changing the rc script:

stats HTML DISCARDABLE "res\stats.html"

and the res path:

res://MyApp.exe/stats

Now it works! However this is really annoying to have to use this way (removing the "." and file extension from the resource name). Does anyone know if this is a bug? A feature? Why does this happen and is there another way around this?

Edit: After playing around some more I found this to work: stats.htm HTML DISCARDABLE "res\stats.html" res://MyApp.exe/stats.htm

changing the ".html" extension in the resource name to ".htm" works but I have no idea why!

解决方案

Make sure the Content Type is set correctly. Make sure that HKEY_CLASSES_ROOT.html has it's Content Type set to "text/html", otherwise strange things happen. Ditto for .htm as well.

这篇关于IE浏览器控制res://用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆