Я пытаюсь показать онлайн/оффлайн контакты из Skype, но я получаю сообщение об ошибке:Skype Ошибка программы API запустить
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsFormsApplication2.exe
Additional information: Retrieving the COM class factory for component with CLSID {830690FC-BF2F-47A6-AC2D-330BCB402664} failed due to the following error: 80040154.
Debugger говорит, что ошибка находится в: Skype skype = new Skype();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SKYPE4COMLib;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
Skype skype = new Skype();
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(loadContacts));
thread.IsBackground = true;
thread.Priority = System.Threading.ThreadPriority.AboveNormal;
thread.Name = "Load Skype Contacts";
thread.Start();
}
private void button1_Click(object sender, EventArgs e)
{
}
List<string> contacts = new List<string>();
public void loadContacts()
{
contacts.Clear();
if (radioButton1.Checked)
{
foreach(User user in skype.Friends)
{
contacts.Add(user.Handle);
}
}
else if (radioButton2.Checked)
{
foreach (User user in skype.Friends)
{
if (user.OnlineStatus == TOnlineStatus.olsOnline | user.OnlineStatus == TOnlineStatus.olsNotAvailable | user.OnlineStatus == TOnlineStatus.olsDoNotDisturb | user.OnlineStatus == TOnlineStatus.olsAway)
{
contacts.Add(user.Handle);
}
}
}
MethodInvoker lvUpdate = delegate
{
listView1.Items.Clear();
foreach (var user in contacts)
{
listView1.Items.Add(user);
}
listView1.Sorting = SortOrder.Ascending;
if (radioButton1.Checked)
{
radioButton1.Text = String.Format("Online ({0})", listView1.Items.Count);
}
else if (radioButton2.Checked)
{
radioButton2.Text = String.Format("All contacts ({0})", listView1.Items.Count);
}
};
Invoke(lvUpdate);
}
}
}
Прикрепите свой Skype-объект к Skype (skype.Attach (protocal, wait))? – thijmen321
Да, у меня есть. Похоже, проблема связана с .dll; Но я не могу понять - почему? Я добавил его из VS2013, он не загружен из других источников. –