Skype API Message output
Asked Answered
R

1

7

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.

Ryanryann answered 28/4, 2015 at 16:7 Comment(1)
What kind of message? Skype chat texts?Somewise
E
2

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);
        }
    }
}
Elaterite answered 8/5, 2015 at 7:7 Comment(3)
Unfortunately, the event gets not triggered until the Skype window gets open. That's very strange and disappointing.Thoroughpaced
@alehro: i am facing same issue, did you get any solution to this problem of code getting called only if skype window is open.Tamasha
@Dr.RajeshRolen No, I didn't. I actually switched to Skype Preview. It has API for bots development. So, I'm going to look in that direction on next occasion. Currently Skype Preview has connection problems and I'm waiting them to be fixed before investing time to that.Thoroughpaced

© 2022 - 2024 — McMap. All rights reserved.