Example #1
0
 /// <summary>Initializes a new instance of the <see cref="ComClassFactory"/> class.</summary>
 /// <param name="punkObject">The COM object that is to be registered as a class object and queried for interfaces.</param>
 /// <param name="classContext">The context within which the COM object is to be run.</param>
 /// <param name="classUse">Indicates how connections are made to the class object.</param>
 public ComClassFactory(IComObject punkObject, CLSCTX classContext, REGCLS classUse)
 {
     comObj = punkObject ?? throw new ArgumentNullException(nameof(punkObject));
     CoRegisterClassObject(comObj.GetType().CLSID(), this, classContext, classUse, out registrationId).ThrowIfFailed();
 }
Example #2
0
 /// <summary>Initializes a new instance of the <see cref="ShellDropTarget"/> class.</summary>
 /// <param name="classContext">The context within which the COM object is to be run.</param>
 /// <param name="classUse">Indicates how connections are made to the class object.</param>
 protected ShellDropTarget(CLSCTX classContext, REGCLS classUse) : base(classContext, classUse)
 {
 }
 public void Register(CLSCTX classContent = CLSCTX.CLSCTX_LOCAL_SERVER, REGCLS classUse = REGCLS.REGCLS_SINGLEUSE) =>
 CoRegisterClassObject(typeof(TObjectToFactory).GUID, this, classContent, classUse, out _dwRegisterClass);
Example #4
0
 public static extern int CoRegisterClassObject(
     ref Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext,
     REGCLS flags,
     out uint lpdwRegister);
Example #5
0
 /// <summary>Initializes a new instance of the <see cref="ShellCommand"/> class.</summary>
 /// <param name="classContext">The context within which the COM object is to be run.</param>
 /// <param name="classUse">Indicates how connections are made to the class object.</param>
 protected ShellCommand(CLSCTX classContext, REGCLS classUse) : base(classContext, classUse)
 {
 }
Example #6
0
 [DllImport("ole32.dll", PreserveSig = false)] // HRESULTの戻り値を例外として受け取る
 protected static extern UInt32 CoRegisterClassObject(
     [In] ref Guid rclsid,
     [MarshalAs(UnmanagedType.Interface), In] IClassFactory pUnk,
     [In] CLSCTX dwClsContext,
     [In] REGCLS flags);
Example #7
0
 public ClassObjectRegistration(Guid clsid, IClassFactory factory, CLSCTX dwClsContext, REGCLS flags)
 {
     cookie = CoRegisterClassObject(clsid, factory, dwClsContext, flags);
 }
Example #8
0
 public static extern int CoRegisterClassObject(
     ref Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext,
     REGCLS flags,
     out uint lpdwRegister);
Example #9
0
 public static extern uint CoRegisterClassObject(
     [MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext, REGCLS flags);