在WPF中我可以使用以下内容:
var texture = (INuiFrameTexture) Marshal.GetObjectForIUnknown(frame.pFrameTexture);
我的INuiFrameTexture看起来像这样:
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("00000000-0000-0000-C000-000000000046")]
internal interface INuiFrameTexture {
[PreserveSig]
int BufferLen();
[PreserveSig]
int Pitch();
[PreserveSig]
HRESULT LockRect(uint Level,ref NuiLockedRect pLockedRect,ref IntPtr pRect,uint Flags);
[PreserveSig]
HRESULT GetLevelDesc(uint Level, NuiSurfaceDesc pDesc);
[PreserveSig]
HRESULT UnlockRect([In] uint Level);
}
现在我正在尝试在Silverlight中实现相同功能,但框架没有GetObjectForIUnknown方法。有人知道在Silverlight中是否有办法做到这一点?