csharp Send Skype messages from webform and winform
2012-07-25 17:43
405 查看
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using SKYPE4COMLib; //下載地址:http://en.sourceforge.jp/projects/sfnet_skype4mp/downloads/Skype4MP/obj/Release/Interop.SKYPE4COMLib.dll/ namespace ListBoxDemo { /// <summary> /// skype 發送信息,也可以用在WinForm /// Geovin Du 塗聚文 /// 締友計算機信息技術有限公司 /// 20120725 ///官網下址:https://developer.skype.com/accessories/skype4com /// </summary> public partial class _Default : System.Web.UI.Page { string strskypeuser = string.Empty; string strskypeid = string.Empty; /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //1 Geovin Du 塗聚文 BindSmartListBox(); //2 Geovin Du 塗聚文 //this.ListBox1.DataSource = skyuselist(); //this.ListBox1.DataTextField = "userDisplayName"; //this.ListBox1.DataValueField = "userLoginName"; //this.ListBox1.DataBind(); } } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { //1 //strskypeuser = ListBox1.SelectedItem.Text; //strskypeid = ListBox1.SelectedValue.ToString(); //2 // strskypeuser = ListBox1.SelectedItem.Text; strskypeid = ListBox1.SelectedValue.ToString(); this.TextBox2.Text = strskypeid; SKYPE4COMLib.Skype oSkype = new SKYPE4COMLib.Skype(); if (!string.IsNullOrEmpty(strskypeid)) { oSkype.SendMessage(strskypeid, strskypeuser + ":" + this.TextBox1.Text); } else { oSkype.SendMessage("ginhongzhao", strskypeuser + ":" + this.TextBox1.Text); } } /// <summary> /// 初始化物件,預設會抓本機的Skype帳號資訊 /// </summary> private void BindSmartListBox() { SKYPE4COMLib.Skype oSkype = new SKYPE4COMLib.Skype(); UserCollection tFriends = oSkype.Friends; ListItem li =null; foreach (User tUser in oSkype.Friends) { if (tUser.FullName.Trim() != "") { li = new ListItem(tUser.FullName, tUser.Handle); ListBox1.Items.Add(li); } else { li = new ListItem(tUser.Handle, tUser.Handle); ListBox1.Items.Add(li); } } } /// <summary> /// 初始化物件,預設會抓本機的Skype帳號資訊 /// </summary> /// <returns></returns> private DataTable skyuselist() { DataTable d = new DataTable(); //初始化物件,預設會抓本機的Skype帳號資訊 SKYPE4COMLib.Skype oSkype = new SKYPE4COMLib.Skype(); UserCollection tFriends = oSkype.Friends; d.Columns.Add("userLoginName", typeof(string)); d.Columns.Add("userDisplayName", typeof(string)); //取出所有的朋友資訊 foreach (User tUser in oSkype.Friends) { if (tUser.FullName.Trim() != "") { d.Rows.Add(tUser.Handle, tUser.FullName); } else { d.Rows.Add(tUser.Handle, tUser.Handle); } } return d; } } }
Download of Interop.SKYPE4COMLib.dll http://en.sourceforge.jp/projects/sfnet_skype4mp/downloads/Skype4MP/obj/Release/Interop.SKYPE4COMLib.dll/
相关文章推荐
- csharp Send Skype messages from webform and winform
- csharp Send Skype messages from webform and winform
- How to: Send and Receive Large Amounts of Data to and from a Web Service
- csharp skype send message in winform
- C# UrlEncode(WinForm and WebForm)
- Major conference and journal for Web Service[updating](zz form yqlb)
- How to implement Drag and Drop from managed WinForm to Explorer
- eclipse及插件安装基础教程[copy and verify from web]
- How to pass ViewState value from web form page to web user control page?
- Some easy ways to send emails (via SMTP) and SMS text messages
- 苹果脚本- Send SMS to Messages and run commands with AppleScript
- 编程遍历页面上所有TextBox控件并给它赋值为string.Empty?(webform&winform)
- ASP.NET WebForm and ASP.NET MVC
- Web Mining via Phantom.js and SharpKit at DevTalk.net
- Tutorial: Importing and analyzing data from a Web Page using Power BI Desktop
- Csharp: Create Excel Workbook or word from Template File using aspose.Word 14.5 and aspose.Cell 8.1
- XBAP run in both Win-Form and Web browser
- 请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?(webform&winform)
- Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications
- [原创]log4net使用(WinForm/WebFrom)