I need to use Shell32 in my C# application to create a lnk file.
I added shell32.dll to my references and tried to compile this single code line:
Shell32.Shell shell = new Shell32.Shell();
and I got an
the error code : 'HRESULT: 0x80004002 (E_NOINTERFACE)).'
How should I use Shell32.Shell?
Thank You, I've found the way with your comments.
I just need to use this as
static readonly Guid CLSID_Shell = Guid.Parse("13709620-C279-11CE-A49E-444553540000"); dynamic shell = Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_Shell));
Also, If I add the
STAThreadAttribute to my Main method it works without problems (credits goes to @Matthew Watson)
User contributions licensed under CC BY-SA 3.0