`
lukeshei
  • 浏览: 383962 次
  • 性别: Icon_minigender_1
  • 来自: 台北
社区版块
存档分类
最新评论

3分鐘學會使用程式發送msn訊息, VB6.0篇(五) (MSN機器人)

阅读更多
<h3?class="post-title?entry-title"><a?href="http: rd-program.blogspot.com="" 2008="" 11="" 3msn-vb60.html"="">3分鐘學會使用程式發送msn訊息,?VB6.0篇(五)<div?class="post-header-line-1"> <div?class="post-body?entry-content">

<a?href="http: www.program.com.tw="" newpage="" msnsdk.htm"=""><font?color="#6699cc">msnSDK訊息控制開發套件?同時支援MSN/Yahoo即時通?訊息雙向傳遞<br?><br?>VB6.0?的範例我們使用ADO介面來處理,其他語言也可以這樣做,可參考文件(文末提供下載處),另外;下面的程式碼重要的部份只有參數不同,其他大同小異,可參考<font?color="#ff0000">紅字部分<br?><br?><br?>ps.也請參考?<a?href="http: rd-program.blogspot.com="" 2008="" 11="" msnsdk.html"=""><font?color="#666699">msnSDK的使用流程?<br?>================================<br?><br?><a?href="http: 4.bp.blogspot.com="" _7dyuztiesgu="" ssdr3aqqn8i="" aaaaaaaaaei="" wsqwzf9xyq4="" s1600-h="" ado.gif"=""><img?id="blogger_photo_id_5269442313894010818"?style="display:?block;?margin:?0px?auto?10px;?width:?400px;?cursor:?hand;?height:?297px;?text-align:?center"?alt=""?border="0"?src="http: 4.bp.blogspot.com="" _7dyuztiesgu="" ssdr3aqqn8i="" aaaaaaaaaei="" wsqwzf9xyq4="" s400="" ado.gif"?=""/><br?><br?>Dim?RS?As?New?ADODB.Recordset<br?>Dim?URL?As?String<br?>Dim?Session?As?String?'授權碼<br?><br?>'取得API?的使用權利<br?>Private?Sub?GETSPID_Click()<br?>Dim?RET?As?String<br?>On?Error?GoTo?ErrHandle<br?><br?>'API?連接位置<br?>URL?=?"http://59.120.234.84:8082/msnSDK/msn_cgi-win32"<br?>'apiblogt5/msnsdkt?取得API?使用權限的帳號/密碼<br?><font?color="#ff0000"><br?>RS.Open?URL?&?"?FUNC=GETSPID&USERID=apiblogt5&PASSWD=msnsdkt&RETTYPE=ADO"<br?><br?>Do?While?Not?(RS.EOF)<br?><br?>'查詢回應<br?>'RS(0)?0?認證失敗?1認證成功<br?>'RS(1)?失敗傳回?失敗原因?/?成功傳回?SESSION<br?>'<br?>If?(RS(0)?=?0)?Then<br?>MsgBox?"認證失敗,無法使用API"<br?>Else<br?>'取得認證授權使用API<br?>'授權碼<br?>Session?=?RS(1)<br?>End?If<br?>RS.MoveNext<br?>Loop<br?>RS.Close<br?>Exit?Sub<br?>ErrHandle:<br?>MsgBox?"無法連接伺服器,或是參數不正確"<br?><br?>End?Sub<br?><br?>'邀請聯絡人<br?>Private?Sub?REGISTER_Click()<br?><br?>Dim?RET?As?String<br?>On?Error?GoTo?ErrHandle<br?><br?>'API?連接位置<br?>URL?=?"http://59.120.234.84:8082/msnSDK/msn_cgi-win32"<br?><br?>'邀請聯絡人?XXXXXXXX@hotmail.com?請填正確的聯絡人,執行此SUB?後<br?>'msnSDK?會邀請這個人加入聯絡人,必須加入聯絡人後才能發送訊息<br?>'session?由GETSPID?所取得的session<br?><font?color="#ff0000"><br?>RS.Open?URL?&?"?UIDS=XXXXXXXX@hotmail.com&FUNC=REGISTER&RETTYPE=ADO&SESSION="?&?<br?>Session<br?><br?>Do?While?Not?(RS.EOF)<br?><br?>'查詢回應<br?>'RS(0)?0?邀請失敗?1邀請成功<br?>'RS(1)?失敗傳回?失敗原因?/?成功訊息<br?>'<br?>If?(RS(0)?=?0)?Then<br?>MsgBox?"邀請失敗"<br?>Else<br?>MsgBox?RS(1)<br?>End?If<br?>RS.MoveNext<br?>Loop<br?>RS.Close<br?>Exit?Sub<br?>ErrHandle:<br?>MsgBox?"無法連接伺服器,或是參數不正確"<br?><br?>End?Sub<br?><br?>'發送MSN/YAHOO即時通訊息<br?>Private?Sub?SENDMSG_Click()<br?>Dim?RET?As?String<br?>On?Error?GoTo?ErrHandle<br?><br?>'API?連接位置<br?>URL?=?"http://59.120.234.84:8082/msnSDK/msn_cgi-win32"<br?><br?>'傳送訊息(MSG)給?XXXXXXXX@hotmail.com(必須是此聯絡人已接受邀請)<br?>'flags?1?當聯絡人不在線上則依據系統設定處理(系統設定為傳送離線訊息)?0?當連絡人不在線上,則不送任何訊息<br?>'encoding?標示目前傳送訊息的中文編碼<br?>'rettype?設定為使用ADO<br?>'session?由GETSPID?所取得的session<br?><font?color="#ff0000"><br?>RS.Open?URL?&?"?UIDS=XXXXXXXX@hotmail.com&MSG=測試&flags=0&FUNC=SENDMSG&ENCODING=BIG5&RETTYPE=ADO&SESSION="?&?Session<br?><br?>Do?While?Not?(RS.EOF)<br?><br?>'查詢回應<br?>'RS(0)?0?傳送失敗?1傳送成功<br?>'RS(1)?失敗傳回?失敗原因?/?成功訊息<br?>'<br?>If?(RS(0)?=?0)?Then<br?>MsgBox?"傳送失敗"<br?>Else<br?>MsgBox?RS(1)<br?>End?If<br?>RS.MoveNext<br?>Loop<br?>RS.Close<br?>Exit?Sub<br?>ErrHandle:<br?>MsgBox?"無法連接伺服器,或是參數不正確"<br?>End?Sub<br?><br?>其他更詳細的參數可以參考<a?href="http: tcmail.program.com.tw="" image="" msnsdk.pdf"=""><font?color="#666699">msnSDK訊息控制開發套件程式介面說明書

<div?style="clear:?both"> <div?class="post-footer"><p?class="post-footer-line?post-footer-line-1"><span?class="post-labels">標籤:?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" 3%e5%88%86%e9%90%98%e5%ad%b8%e6%9c%83%e4%bd%bf%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%99%bc%e9%80%81msn%e8%a8%8a%e6%81%af"=""><font?color="#666699">3分鐘學會使用程式發送msn訊息,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msnbot"=""><font?color="#6699cc">msnbot,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msnlib"=""><font?color="#6699cc">msnlib,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msnp15"=""><font?color="#6699cc">MSNP15,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msnsdk"=""><font?color="#6699cc">msnSDK,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msnsdk%e8%a8%8a%e6%81%af%e6%8e%a7%e5%88%b6%e9%96%8b%e7%99%bc%e5%a5%97%e4%bb%b6"=""><font?color="#6699cc">msnSDK訊息控制開發套件,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" msn%e6%a9%9f%e5%99%a8%e4%ba%ba"=""><font?color="#666699">msn機器人,?<a?rel="tag"?href="http: rd-program.blogspot.com="" search="" label="" vbmsn"=""><font?color="#6699cc">vbmsn

<textarea?class="vb"?name="code">請在此填寫程式碼

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics