0
我試圖在網上顯示/通過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.
調試器說,一個錯誤是: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添加它,它不是從其他來源下載。 –