BitmapEffect.CreateBitmapEffectOuter Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

obsoleteCodeEntityT:System.Windows.Media.Effects.EffectNote: This API is now obsolete.

Creates a handle to an IMILBitmapEffect object that is used to initialize a custom effect.

Namespace:   System.Windows.Media.Effects
Assembly:  PresentationCore (in PresentationCore.dll)

[ObsoleteAttribute("BitmapEffects are deprecated and no longer function.  Consider using Effects where appropriate instead.")]
protected static SafeHandle CreateBitmapEffectOuter()

Return Value

Type: System.Runtime.InteropServices.SafeHandle

A handle to an IMILBitmapEffect object.

Framework interaction with custom effects is handled through an IMILBitmapEffect object. The outer effect is initialized with the custom effect through the InitializeBitmapEffect method.

The following example shows an implementation of CreateUnmanagedEffect that uses the CreateBitmapEffectOuter method to retrieve a wrapper effect object.

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
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,
ref IID_IUnknown,
out unmanagedEffect);
    InitializeBitmapEffect(wrapper, unmanagedEffect);
    if (0 == hresult) return wrapper;
    throw new Exception("Cannot instantiate effect. HRESULT = " + hresult.ToString());

.NET Framework
Available since 3.0
Return to top