轉(zhuǎn)載地址:http://www.shnenglu.com/bigsml/archive/2008/03/23/45145.html
可插入?yún)f(xié)議擴(kuò)展(Asynchronous Pluggable Protocols)主要基于異步的URL Moniker技術(shù)。 IE的URL Moniker在urlmon.dll 動態(tài)庫中實現(xiàn)的, 有兩種處理機(jī)制:
1. 根據(jù)URL 協(xié)議調(diào)用外部程序處理
比如telnet: or news: or mailto:,當(dāng)訪問這些url的時候會打開相應(yīng)的程序來處理。
比如要添加note:協(xié)議(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. 根據(jù)URL 協(xié)議調(diào)用類對象來處理
可以根據(jù)URL 協(xié)議或者M(jìn)IME type 注冊不同的處理對象
有兩種方式:
a) 通過在注冊表將URL 協(xié)議與COM 對象關(guān)聯(lián)
主要在注冊表中的
HKEY_CLASSES_ROOT\PROTOCOLS\Handler # URL 協(xié)議
HKEY_CLASSES_ROOT\PROTOCOLS\Filter # Mime Filter
b) 通過臨時注冊類對象將URL 協(xié)議與其關(guān)聯(lián)
// 注冊
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 的實現(xiàn)可以參考
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技術(shù)對網(wǎng)頁源碼進(jìn)行過濾(監(jiān)視下載文件)
http://blog.csdn.net/lion_wing/archive/2006/06/27/839134.aspx
HTML代碼過濾技術(shù)
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分,高手進(jìn)來動手試試:如何提取AJAX里的HTML內(nèi)容?
http://topic.csdn.net/t/20061214/12/5230161.html
這里主要通過監(jiān)視IE 的下載從而保存Google Map 的地圖數(shù)據(jù)文件. 通過監(jiān)視http & text/html & application/javascript 的內(nèi)容來獲取圖片文件URL 和 信息.. :)