我的玻璃盒子

(转载)IE 异步可插入协议扩展

转载地址:http://www.cppblog.com/bigsml/archive/2008/03/23/45145.html

 

可插入协议扩展(Asynchronous Pluggable Protocols)主要基于异步的URL Moniker技术。 IE的URL Moniker在urlmon.dll 动态库中实现的, 有两种处理机制:
1. 根据URL 协议调用外部程序处理
比如telnet: or news: or mailto:,当访问这些url的时候会打开相应的程序来处理。
比如要添加note:协议(Registering an Application to a URL Protocol), 则只要修改注册表
[HKEY_CLASSES_ROOT]
    [note]
        (Default) = "URL:Note Protocol"
        URL Protocol = ""
        [DefaultIcon]
            (Default) = "notepad.exe"
        [shell]
            [open]
                [command]
                    (Default) = "c:\windows\notepad.exe %1"
在IE 中输入 note://xxx.txt 的时候会自动用notepad 打开xxx.txt 文件

2. 根据URL 协议调用类对象来处理
可以根据URL 协议或者MIME type 注册不同的处理对象
有两种方式:
a) 通过在注册表将URL 协议与COM 对象关联
主要在注册表中的
HKEY_CLASSES_ROOT\PROTOCOLS\Handler # URL 协议
HKEY_CLASSES_ROOT\PROTOCOLS\Filter # Mime Filter

b) 通过临时注册类对象将URL 协议与其关联
// 注册
CComPtr<IInternetSession> spSession;
CComPtr<IClassFactory>   spCFHTTP;
HRESULT hr = CoInternetGetSession(0, &spSession, 0);
hr = FilterFactory::CreateInstance(CLSID_HttpProtocol, &spCFHTTP);
hr = spSession->RegisterNameSpace(spCFHTTP, CLSID_NULL, L"http", 0, 0, 0);

// 反注册
spSession->UnregisterNameSpace(spCFHTTP, L"http");

3. FilterFactory 的实现可以参考
Asynchronous Pluggable Protocol Implementation with ATL
http://www.codeguru.com/cpp/com-tech/atl/misc/article.php/c37/
Internet Explorer下载文件的终极过滤
http://blog.csdn.net/111222/archive/2002/02/09/7255.aspx

通过Mime filter技术对网页源码进行过滤(监视下载文件)
http://blog.csdn.net/lion_wing/archive/2006/06/27/839134.aspx
HTML代码过滤技术
http://blog.csdn.net/lion_wing/articles/534716.aspx

About Asynchronous Pluggable Protocols (MSDN)
Internet Explorer 编程简述(九)在自己的浏览器中嵌入Google工具条
http://blog.csdn.net/CathyEagle/archive/2005/12/12/550698.aspx
放1000分,高手进来动手试试:如何提取AJAX里的HTML内容?
http://topic.csdn.net/t/20061214/12/5230161.html
这里主要通过监视IE 的下载从而保存Google Map 的地图数据文件.  通过监视http & text/html & application/javascript 的内容来获取图片文件URL 和 信息.. :)

posted on 2008-03-24 21:20 深蓝色系统 阅读(1040) 评论(0)  编辑 收藏 引用 所属分类: 皮皮片片


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

统计

常用链接

留言簿(75)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜