【问题标题】:Skype API Message outputSkype API 消息输出
【发布时间】:2015-07-07 14:25:54
【问题描述】:

如何从 Skype 接收消息并将其输出到我的应用程序 (textbox1.Text)? 我在 skype4com 文档中寻找它,但没有找到任何东西。

【问题讨论】:

  • 什么样的消息? Skype 聊天文本?

标签: c# skype skype4com


【解决方案1】:

要收听聊天消息,您可以执行以下操作:

//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);
        }
    }
}

【讨论】:

  • 不幸的是,在 Skype 窗口打开之前不会触发该事件。这是非常奇怪和令人失望的。
  • @alehro:我面临同样的问题,你有没有解决这个问题的解决方案,只有当Skype窗口打开时才会调用代码。
  • @Dr.RajeshRolen 不,我没有。我实际上切换到 Skype Preview。它具有用于机器人开发的 API。所以,下次我会朝这个方向看。目前 Skype 预览版存在连接问题,我正在等待它们得到修复,然后再投入时间。
猜你喜欢
  • 2017-10-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-08
  • 2011-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多