I know that in C# in general you can't create an instance of an abstract class or an interface. Can someone help me understand this code (it compile without any errors).
Shell32.Shell shObj = new Shell32.Shell();
Shell32.Shell
is an interface from 'shell32.dll'
I tried the following, but it did NOT compile:
[CoClass(typeof(ShellClass))]
[Guid("286E6F1B-7113-4355-9562-96B7E9D64C54")]
public interface OtherShell : Shell
{
}
OtherShell shObj = new OtherShell();
Update:
To make it work, I just needed to add the ComImport
attribute and change the co-class (I can't choose Shell32.ShellClass).
Thanks guys!