I'm trying to make use of SKYPE4COMLib.dll
.
I've got past referencing the library (huh), and now I'm trying to create an instance of skype:
Skype s=new SkypeClass();
I'm getting following errors:
The type 'SKYPE4COMLib.SkypeClass' has no constructors defined
and
Interop type 'SKYPE4COMLib.SkypeClass' cannot be embedded. Use the applicable interface instead.
The samples I've seen are in VB, and they use
Set oSkype = WScript.CreateObject("Skype4COM.Skype", "Skype_")
which I don't know how to translate.
Also, I've found following question, which seems related, but the answer doesn't seem to be applicable to c#.
How do I create the Skype class in c#?
Quite simply it is just
Skype skype = new Skype();
Even though Skype
is technically a interface you can still call new
on it due to it being a COM interface, that is how C# com interop works.
The way to tell is by going to the "go to definition" tab for the Skype class, it should look like this.
[CoClass(typeof(SkypeClass))]
[Guid("B1878BFE-53D3-402E-8C86-190B19AF70D5")]
public interface Skype : ISkype, _ISkypeEvents_Event
{
}
That CoClass(typeof(SkypeClass))
is what lets you call new
on the interface.