[DllImport("ole32.dll", CharSet=CharSet.Unicode, ExactSpelling=true, PreserveSig=false)]
static extern void CoCreateInstanceEx(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
[MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter,
CLSCTX dwClsCtx,
IntPtr pServerInfo,
uint cmq,
[In, Out] MULTI_QI[] pResults);
None.
Please add some!
Please add some!
Have a look at System.Activator.CreateInstance and its various overloads. Sample:
Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");
Type shellDesktopType = Type.GetTypeFromCLSID(CLSID_ShellDesktop, true); // (Guid, serverName, throwOnError)
object shellDesktop = Activator.CreateInstance(shellDesktopType);
If you just want to create an instance on a specific server, try Microsoft.VisualBasic.Interaction.CreateObject.