【发布时间】:2015-07-07 14:25:54
【问题描述】:
如何从 Skype 接收消息并将其输出到我的应用程序 (textbox1.Text)?
我在 skype4com 文档中寻找它,但没有找到任何东西。
【问题讨论】:
-
什么样的消息? Skype 聊天文本?
如何从 Skype 接收消息并将其输出到我的应用程序 (textbox1.Text)?
我在 skype4com 文档中寻找它,但没有找到任何东西。
【问题讨论】:
要收听聊天消息,您可以执行以下操作:
//First make a reference to skype4com, probably in here: C:\Program Files (x86)\Common Files\Skype
//Then use the following code:
using System;
using System.Windows.Forms;
using SKYPE4COMLib;
namespace Skype
{
public partial class Form1 : Form
{
private SKYPE4COMLib.Skype skype;
public Form1()
{
InitializeComponent();
skype = new SKYPE4COMLib.Skype();
skype.Attach(7, false);
skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
}
private void skype_MessageStatus(ChatMessage msg, TChatMessageStatus status)
{
string message = msg.Sender + ": " + msg.Body;
listBox1.Items.Add(message);
}
}
}
【讨论】: