我正在使用Skype API。当我的应用程序启动时,我会检查Skype是否实际运行。
foreach (Process p in System.Diagnostics.Process.GetProcessesByName("skype"))
{
return true;
}
现在我想检查用户是否已登录Skype。我怎么检查这个?
答案 0 :(得分:4)
下载Skype API以检查...因为好奇心。实际上对于暴露了多少东西感到惊讶。
Skype skype = new Skype();
// Return true if Skype is running.
if (!skype.Client.IsRunning)
return;
// User is not logged in.
if (skype.CurrentUserStatus == TUserStatus.cusLoggedOut)
return;
// Friends
foreach(User user in skype.Friends)
{
if (user.OnlineStatus == TOnlineStatus.olsOnline)
{ /*Insert what you want...*/ }
}
请注意,Skype首先会询问您是否要让特定插件访问它。