tencent://message協議


tencent://message協議  

|舉報|字號 訂閱

 
 

相信很多朋友在訪問別人的博客、網上商城時可能會發現上都有這樣的小玩意tencent://message協議 - 沓字沼 - 沓字沼的博客, 點擊下就可以彈出對話框和主人進行對話,而且無需加對方為好友。 

◆騰訊提供的代碼為:(騰訊官方鏈接: http://is.qq.com/webpresence/code.shtml

<a href="tencent://message/?uin=88888888&Site=JooIT.com&Menu=yes">
<img border="0" SRC='http://is.qq.com/webpresence/images/status/01_online.gif' alt="點擊這里給我發消息">
</a>

有時在瀏覽器地址中輸入:  tencent://message/?uin=*********  (********代表對方QQ)就可以彈出對話框和對方進行對話,同樣無需加對方為好友(前提是對方沒有設置身份認證)。也可在cmd中執行start tencent://message/?uin=********* 也可有相同效果。注:tencent://message/?uin=*********&Site=&Menu=yes  這是QQ推出的新代碼,以前用的是http://wpa.qq.com/msgrd?V=1&Uin==*********&Site=&Menu=yes

 

 

 

◆要說明它的工作原理還要細談微軟關於注冊應用程序協議的說明 Registering an Application to a URL Protocol

微軟官方說明:http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/pluggable/overview/appendix_a.asp

此文中對於 Windows、Linux 和 OS X 操作系統如何注冊協議都有說明。比如說 Windows,其實只需寫入注冊表,即可實現協議與執行程序的關聯。

詳細說明請參考:Register protocol  

 

◆到這里我們再來剖析tencent://message/?uin=********的實現原理,騰訊的Tencent://Message協議注冊表如下:

[HKEY_CLASSES_ROOT\TENCENT]
@=”TencentProtocol”
"URL Protocol”="D:\\Program Files\\Tencent\\QQ\\bin\\Timwp.exe"

[HKEY_CLASSES_ROOT\TENCENT\DefaultIcon]
@=”D:\\Program Files\\Tencent\\QQ\\Timwp.exe,1″

[HKEY_CLASSES_ROOT\TENCENT\shell]

[HKEY_CLASSES_ROOT\TENCENT\shell\open]

[HKEY_CLASSES_ROOT\TENCENT\shell\open\command]
@="\"D:\\Program Files\\Tencent\\QQ\\bin\\Timwp.exe\"  \"%1\”"

此注冊表所實現的就是當瀏覽器(或其它)碰到 tencent://… 時,自動調用 Timwp.exe,並把 tencent://… 地址作為第一個參數傳遞給 Timwp.exe。

◆騰訊又為廣大網友推出一項新的服務Web presence,這項新服務可以不用登錄QQ,只要把生成的代碼嵌入到網頁或是論壇上,代碼會生成一個按鈕,通過這個按扭就能看到你的QQ是否在線,同時更絕的是只要點擊這個按扭,還可以給QQ發送消息,即使沒有加好友,也可以自如的聊天,這是它的官方登入網頁http://is.qq.com/webpresence,有興趣的朋友可以在網頁試驗如下代碼中Q我。

[img]http://wpa.qq.com/pa?p=1:1103150:13[/img]

[url=http://wpa.qq.com/msgrd?V=1&Uin=744014863&Site=yrj9814.blog.163.com&Menu=yes]有事點這里給我qq留言[/url]

同樣可以在地址欄輸入http://wpa.qq.com/msgrd?V=1&Uin=744014863&Site=yrj9814.blog.163.com&Menu=yes   Q我(這里site=連接到的網頁,也可以自定義)

 

 

◆當然了解了微軟協議的知識,也可以動手自定義協議,以下借鑒網友的自定義的HelloWorld協議來實現發送消息,注冊表信息如下:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\HelloWorld]
@="HelloWorld Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\HelloWorld\DefaultIcon]
@="D:\\My Documents\\Visual Studio 2005\\Projects\\HelloWorld\\release\\HelloWorld.exe,1"
[HKEY_CLASSES_ROOT\HelloWorld\shell]
@=""
[HKEY_CLASSES_ROOT\HelloWorld\shell\open]
@=""
[HKEY_CLASSES_ROOT\HelloWorld\shell\open\command]
@="\"D:\\My Documents\\Visual Studio 2005\\Projects\\HelloWorld\\release\\HelloWorld.exe\" \"%1\"

(源代碼下載:http://files.cnblogs.com/phinecos/HelloWorldProtocal.rar)

 

 

★★★★★★★★★★★★★★★★★以下提供幾種QQ風格代碼★★★★★★★★★★★★★★★★★★★★★

風格1 在線狀態: http://is.qq.com/webpresence/images/status/01_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/01_offline.gif[*/img] 
風格2 在線狀態: http://is.qq.com/webpresence/images/status/02_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/02_offline.gif[*/img]  
風格3 在線狀態: http://is.qq.com/webpresence/images/status/03_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/03_offline.gif[*/img]  
風格4 在線狀態: http://is.qq.com/webpresence/images/status/04_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/04_offline.gif[*/img]  
風格5 在線狀態: http://is.qq.com/webpresence/images/status/05_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/05_offline.gif[*/img]  
風格6 在線狀態: http://is.qq.com/webpresence/images/status/6_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/6_offline.gif[*/img]  
風格7 在線狀態: http://is.qq.com/webpresence/images/status/7_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/7_offline.gif[*/img]  
風格8 在線狀態: http://is.qq.com/webpresence/images/status/8_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/9_offline.gif[*/img] 
風格9 在線狀態: http://is.qq.com/webpresence/images/status/9_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/9_offline.gif[*/img] 
風格10 在線狀態: http://is.qq.com/webpresence/images/status/10_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/10_offline.gif[*/img]  
風格11 在線狀態: http://is.qq.com/webpresence/images/status/11_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/11_offline.gif[*/img]  
風格12 在線狀態: http://is.qq.com/webpresence/images/status/12_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/12_offline.gif[*/img]  
風格13 在線狀態: http://is.qq.com/webpresence/images/status/13_online.gif[*/img]離線狀態: http://is.qq.com/webpresence/images/status/13_offline.gif[*/img]

 

 

圖片 地址
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/05_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/6_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/7_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/05_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/6_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/7_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/8_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/8_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/9_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/10_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/11_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/11_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/12_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/12_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/04_online.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/04_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/13_offline.gif
tencent://message協議 - 沓字沼 - 沓字沼的博客 http://is.qq.com/webpresence/images/status/13_online.gif

 

登陸你的QQ空間后點自定義(快捷鍵Ctrl+j,Alt+j)點新建模塊→大圖模塊→輸入或者粘貼剛復制的地址。然后點“更多設置”,點開之后下面有個顯示邊框,點“不顯示”。上面有個圖片連接地址輸入:

tencent://message/?uin=*****&Site=www.qqkj.cn&Menu=yes

把上面地址中的*****改成你的qq號碼,最后提交就可以了!

 

 

以上的只是本人的淺解,參考資料:

1、Registering an Application to a URL Protocol

2、Register protocol

3、仿騰訊 QQ 和 Skype 通過URL觸發自己的程序

4、由Tencent://Message協議想到的一個解決方案

 
from:http://blog.csdn.net/zanfeng/article/details/37915111


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM