C# Skype API 的实现
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1259923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Implementation of Skype API
提问by
Possible Duplicate:
Skype Addon in C#
可能的重复:
C# 中的 Skype 插件
How can I implement the Skype API to access user information in C#?
如何在 C# 中实现 Skype API 来访问用户信息?
回答by Dirk Vollmar
UPDATE: Unfortunately, the documentation is no longer available. There is a chance though, that the below code still works, but afaik Microsoft has long planned to remove support for COM automation from Skype.
更新:不幸的是,该文档不再可用。虽然有可能,下面的代码仍然有效,但微软早就计划从 Skype 中删除对 COM 自动化的支持。
It is probably easiest to download and install the Skype API COM Wrapper.
下载和安装 Skype API COM Wrapper可能是最简单的。
Then you can simply add a reference to this wrapper from the COM tab of the Add Referencesdialog in your Visual Studio project.
然后,您可以简单地从Visual Studio 项目中“添加引用”对话框的“COM”选项卡添加对此包装器的引用。
Below is a short sample program illustrating how to search for a user and how to send a message:
下面是一个简短的示例程序,说明如何搜索用户以及如何发送消息:
using System;
using SKYPE4COMLib;
class Program
{
static void Main(string[] args)
{
Skype skype = new Skype();
if (!skype.Client.IsRunning)
{
// start minimized with no splash screen
skype.Client.Start(true, true);
}
// wait for the client to be connected and ready
skype.Attach(6, true);
// access skype objects
Console.WriteLine("Missed message count: {0}", skype.MissedMessages.Count);
// do some stuff
Console.WriteLine("Enter a skype name to search for: ");
string username = Console.ReadLine();
foreach (User user in skype.SearchForUsers(username))
{
Console.WriteLine(user.FullName);
}
Console.WriteLine("Say hello to: ");
username = Console.ReadLine();
skype.SendMessage(username, "Hello World");
}
}
回答by REA_ANDREW
Just to point out here. After downloading the Skype4COM.dll you will probably need to use regsvr32 to register the dll, that way inside Visual Studio you can add the .dll as a recognised COM Component!
只是在这里指出。下载 Skype4COM.dll 后,您可能需要使用 regsvr32 来注册 dll,这样您就可以在 Visual Studio 中将 .dll 添加为可识别的 COM 组件!
regsvr32 C:\Windows\System32\Skype4COM.dll
for example, you will get a popup indicating it successfully registered it, and now back in your IDE, inside the Add Reference under the COM Tab you will see the Skype Library.
例如,您将看到一个弹出窗口,表明它已成功注册它,现在回到您的 IDE,在 COM 选项卡下的添加引用内,您将看到 Skype 库。
Hope this helps,
希望这可以帮助,
Andrew
安德鲁
回答by Jirapong
If you means to access status of particular user from ASP.NET.
如果您打算从 ASP.NET 访问特定用户的状态。
so, you want to know if that person is available or not. add image link to this url.
所以,你想知道那个人是否有空。将图片链接添加到此网址。
<img src="http://mystatus.skype.com/smallclassic/skypename" />
Where skyname is the person that you want to show status.
其中 skyname 是您要显示状态的人。
To make a link for Skype's profile
为 Skype 的个人资料制作链接
<a href="skype:skypename?userinfo">Joe Doe's Profile</a>
but if you want to do it other way e.g. Code-Behind - Then this link should provide all example you need - https://developer.skype.com/Docs/Skype4COM/Example?action=show
但如果你想以其他方式做到这一点,例如代码隐藏 - 那么这个链接应该提供你需要的所有例子 - https://developer.skype.com/Docs/Skype4COM/Example?action=show
IUserCollection iusercollection = skype.SearchForUsers("echo123");
if (iusercollection.Count > 0)
{
Console.WriteLine(iusercollection[0].FullName);
}
List of all IUser interface can find at https://developer.skype.com/Docs/Skype4COMLib/IUser
所有 IUser 界面的列表可以在https://developer.skype.com/Docs/Skype4COMLib/IUser找到
Hope this helps
希望这可以帮助
回答by Dan
The main skype download site is no longer live, here is a mirror:
主要的skype下载站点不再存在,这里是一个镜像: