BitmapEffect.CreateBitmapEffectOuter 方法

定义

注意

BitmapEffects are deprecated and no longer function. Consider using Effects where appropriate instead.

对用于初始化自定义效果的 IMILBitmapEffect 对象创建句柄。

protected:
 static System::Runtime::InteropServices::SafeHandle ^ CreateBitmapEffectOuter();
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected static System.Runtime.InteropServices.SafeHandle CreateBitmapEffectOuter ();
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
[System.Obsolete("BitmapEffects are deprecated and no longer function.  Consider using Effects where appropriate instead.")]
protected static System.Runtime.InteropServices.SafeHandle CreateBitmapEffectOuter ();
[System.Obsolete("BitmapEffects are deprecated and no longer function.  Consider using Effects where appropriate instead.")]
protected static System.Runtime.InteropServices.SafeHandle CreateBitmapEffectOuter ();
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
static member CreateBitmapEffectOuter : unit -> System.Runtime.InteropServices.SafeHandle
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
[<System.Obsolete("BitmapEffects are deprecated and no longer function.  Consider using Effects where appropriate instead.")>]
static member CreateBitmapEffectOuter : unit -> System.Runtime.InteropServices.SafeHandle
[<System.Obsolete("BitmapEffects are deprecated and no longer function.  Consider using Effects where appropriate instead.")>]
static member CreateBitmapEffectOuter : unit -> System.Runtime.InteropServices.SafeHandle
Protected Shared Function CreateBitmapEffectOuter () As SafeHandle

返回

SafeHandle

IMILBitmapEffect 对象的句柄。

属性

示例

下面的示例演示了使用该CreateBitmapEffectOuter方法检索包装效果对象的实现CreateUnmanagedEffect

unsafe protected override SafeHandle CreateUnmanagedEffect()
{
    const uint CLSCTX_INPROC_SERVER = 1;
    Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");
    Guid guidEffectCLSID = new Guid("84CF07CC-34C4-460f-B435-3184F5F2FF2A");
    SafeHandle wrapper = BitmapEffect.CreateBitmapEffectOuter();

    COMSafeHandle unmanagedEffect;
    uint hresult = Ole32Methods.CoCreateInstance(
                        ref guidEffectCLSID,
                        wrapper.DangerousGetHandle(),
                        CLSCTX_INPROC_SERVER,
                        ref IID_IUnknown,
                        out unmanagedEffect);
    InitializeBitmapEffect(wrapper, unmanagedEffect);
    if (0 == hresult) return wrapper;
    throw new Exception("Cannot instantiate effect. HRESULT = " + hresult.ToString());
}
<SecurityPermissionAttribute(SecurityAction.Demand, Flags := SecurityPermissionFlag.UnmanagedCode)>
Protected Overrides Function CreateUnmanagedEffect() As SafeHandle
    Const CLSCTX_INPROC_SERVER As UInteger = 1
    Dim IID_IUnknown As New Guid("00000000-0000-0000-C000-000000000046")
    Dim guidEffectCLSID As New Guid("84CF07CC-34C4-460f-B435-3184F5F2FF2A")
    Dim wrapper As SafeHandle = BitmapEffect.CreateBitmapEffectOuter()

    Dim unmanagedEffect As COMSafeHandle
    Dim hresult As UInteger = Ole32Methods.CoCreateInstance(guidEffectCLSID, wrapper.DangerousGetHandle(), CLSCTX_INPROC_SERVER, IID_IUnknown, unmanagedEffect)
    InitializeBitmapEffect(wrapper, unmanagedEffect)
    If 0 = hresult Then
        Return wrapper
    End If
    Throw New Exception("Cannot instantiate effect. HRESULT = " & hresult.ToString())
End Function

注解

框架与自定义效果的交互通过 IMILBitmapEffect 对象进行处理。 外部效果通过 InitializeBitmapEffect 该方法使用自定义效果进行初始化。

适用于