locked
Fixed. Platform::ComException on ID2D1DeviceContext::CreateEffect method RRS feed

  • Question

  • I try to implement custom effect on direct2d, my Effects Register method works fine, but on createeffect method I have returned value  "HRESULT_FROM_WIN32(ERROR_NOT_FOUND): Element not found". Here is my Register, and pointer creating methods.And my project is a dll.
    HRESULT SplashEffect::Register(_In_ ID2D1Factory1* pFactory)
    {
    	// The inspectable metadata of an effect is defined in XML. This can be passed in from an external source
    	// as well, however for simplicity we just inline the XML.
    	PCWSTR pszXml =
    		 XML(
              <?xml version='1.0'?>
    		   <Effect>
                    <!-- System Properties -->
                    <Property name='DisplayName' type='string' value='Ripple'/>
                    <Property name='Author' type='string' value='Microsoft Corporation'/>
                    <Property name='Category' type='string' value='Stylize'/>
                    <Property name='Description' type='string' value='Adds a ripple effect that can be animated'/>
                    <Inputs>
                        <Input name='Source'/>
                    </Inputs>
    				 </Effect>
                );
       
    
    	
    	return pFactory->RegisterEffectFromString(
    		GUID_COLOR_SPLASH_EFFECT,
    		pszXml,
    		nullptr,
    		0,
    		CreateEffectImpl
    		);
    }
    
    
    HRESULT __stdcall SplashEffect::CreateEffectImpl(_Outptr_ IUnknown** ppEffectImpl)
    {
    	// Since the object's refcount is initialized to 1, we don't need to AddRef here.
    	*ppEffectImpl = static_cast<ID2D1EffectImpl*>(new (std::nothrow) SplashEffect());
    
    	if (*ppEffectImpl == nullptr)
    	{
    
    		return E_OUTOFMEMORY;
    	}
    	else
    	{
    		return S_OK;
    	}
    }



    • Edited by Lus13 Tuesday, November 4, 2014 9:03 AM
    Thursday, October 30, 2014 1:26 PM

All replies

  • I'll ask our DirectX engineer to check on this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, October 31, 2014 12:39 PM
    Moderator