Skype的 - 如何开始? [英] Skype - How to get started?

查看:257
本文介绍了Skype的 - 如何开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很多时间。而整个Skype的论坛似乎破损或死或他们没有技术家伙来处理的部门。



入门代码示例不工作或不可用(完全正常)。例如: http://forum.skype.com/index.php?showtopic=3557



因此,我请求能有人好心请告诉我一个简单的C#的工作代码示例如何刚上手一步一步来。



先谢谢了。


解决方案

  1. 添加到Skype的一个参考COM库

  2. 添加下面的类,并开始探索的Skype。



代码(包括使用SKYPE4COMLib; ,它搞砸了计算器语法高亮显示)

 命名实例
{
类SkypeExample
{
私人SkypeClass _skype;

公共SkypeExample()
{
_skype =新SkypeClass();
_skype.MessageStatus + =的onMessage;
_skype._ISkypeEvents_Event_AttachmentStatus + = OnAttach;
_skype.Attach(7,FALSE);
}

私人无效OnAttach(TAttachmentStatus状态)
{
//这个应用程序被成功连接到Skype的
}

私人无效的onMessage(ChatMessage pmessage,TChatMessageStatus状态)
{
//不,如果没有收到该消息做任何事情,如果(状态(即我们发送emssage)
!= TChatMessageStatus。 cmsReceived)
的回报;

//简单的echo服务。
_skype.get_Chat(pmessage.ChatName).SendMessage(pmessage.Body);
}

公共BOOL MakeFriend(字符串处理)
{
的for(int i = 1; I< = _skype.Friends.Count;我++)
{
如果(_skype.Friends [I] .Handle ==手柄)
返回真;
}

UserCollection集合= _skype.SearchForUsers(句柄);
如果(collection.Count> = 1)
集合[1] .BuddyStatus = TBuddyStatus.budPendingAuthorization;

返回false;
}
}
}


I spend lot of time. And the whole Skype forum seems broken or dead or they don't have technical guys to handle those sectors.

Getting started code examples are not working or not available (completely abnormal). ex: http://forum.skype.com/index.php?showtopic=3557

Therefore, i request can someone kindly please show me a simple C# working code example how to just get started step by step.

Thanks in advance.

解决方案

  1. Add a reference to the skype COM library
  2. Add the following class and start exploring skype.

code (include using SKYPE4COMLib;, it screws up stackoverflow syntax highlighting)

namespace Example
{
    class SkypeExample
    {
        private SkypeClass _skype;

        public SkypeExample()
        {
            _skype = new SkypeClass();
            _skype.MessageStatus += OnMessage;
            _skype._ISkypeEvents_Event_AttachmentStatus += OnAttach;
            _skype.Attach(7, false);
        }

        private void OnAttach(TAttachmentStatus status)
        {
            // this app was successfully attached to skype
        }

        private void OnMessage(ChatMessage pmessage, TChatMessageStatus status)
        {
            // dont do anything if the message is not received (i.e. we are sending a emssage)
            if (status != TChatMessageStatus.cmsReceived)
                return;

            // simple echo service.
            _skype.get_Chat(pmessage.ChatName).SendMessage(pmessage.Body);
        }

        public bool MakeFriend(string handle)
        {
            for (int i = 1; i <= _skype.Friends.Count; i++)
            {
                if (_skype.Friends[i].Handle == handle)
                    return true;
            }

            UserCollection collection = _skype.SearchForUsers(handle);
            if (collection.Count >= 1)
                collection[1].BuddyStatus = TBuddyStatus.budPendingAuthorization;

            return false;
        }
    }
}

这篇关于Skype的 - 如何开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆