コード例 #1
0
ファイル: ComClassFactory.cs プロジェクト: gigi81/Vanara
 /// <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();
 }
コード例 #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)
 {
 }
コード例 #3
0
 public void Register(CLSCTX classContent = CLSCTX.CLSCTX_LOCAL_SERVER, REGCLS classUse = REGCLS.REGCLS_SINGLEUSE) =>
 CoRegisterClassObject(typeof(TObjectToFactory).GUID, this, classContent, classUse, out _dwRegisterClass);
コード例 #4
0
ファイル: ComNative.cs プロジェクト: wkfff/Taxprep-Add-Ins
 public static extern int CoRegisterClassObject(
     ref Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext,
     REGCLS flags,
     out uint lpdwRegister);
コード例 #5
0
ファイル: ShellCommand.cs プロジェクト: gigi81/Vanara
 /// <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)
 {
 }
コード例 #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);
コード例 #7
0
 public ClassObjectRegistration(Guid clsid, IClassFactory factory, CLSCTX dwClsContext, REGCLS flags)
 {
     cookie = CoRegisterClassObject(clsid, factory, dwClsContext, flags);
 }
コード例 #8
0
ファイル: NativeMethods.cs プロジェクト: cems1111/NRegFreeCom
 public static extern int CoRegisterClassObject(
     ref Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext,
     REGCLS flags,
     out uint lpdwRegister);
コード例 #9
0
 public static extern uint CoRegisterClassObject(
     [MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
     [MarshalAs(UnmanagedType.Interface)] IClassFactory pUnk,
     CLSCTX dwClsContext, REGCLS flags);