Skype API Message output

前端 未结 1 1078
说谎
说谎 2021-01-05 12:12

How can I receive and output message from Skype to my application (textbox1.Text)? I was looking for it in skype4com documentation but didn\'t find anything.

相关标签:
1条回答
  • 2021-01-05 13:03

    To listen for chat messages you can do something like this:

    //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);
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题