I'm not a C++ guy and I'm having some trouble understanding how to pass a function pointer/callback function to a method. The callback is defined as follows
typedef HRESULT (CALLBACK *PFN_CREATE_XAMLOBJECT)(
IXRDependencyObject *pExistingXRDO,
UINT objectId
);
The method I am attempting to pass it too is defined as follows (all other params removed)
virtual HRESULT STDMETHODCALLTYPE RegisterXamlObject(
__in PFN_CREATE_XAMLOBJECT pfXamlObjectCreation,
) = 0;
The function I have defined to pass on is as follows
HRESULT CreateFn(__in IXRDependencyObject *pExistingXRDO, UINT objectId)
{
return S_OK;
}
I am attempting to pass the the function pointer as follows.
&MyClass::CreateFn
I get the following error
Error 3 error C2440: 'type cast' : cannot convert from 'HRESULT (__cdecl MyClass::* )(IXRDependencyObject *,UINT)' to 'PFN_CREATE_XAMLOBJECT'
Any help would be much appreciated.