如何传递C#WPF表单的HWND和HINSTANCE?C++ WPF通过HWND和HINSTANCE的C++/CLI
尝试:
C++/CLI:
BOOL Initialize(double width, double height, HWND parent, HINSTANCE hiparent)
{
C#
HwndSource hwnd = (HwndSource)HwndSource.FromVisual(this.renderControl);
IntPtr hinstance = Marshal.GetHINSTANCE(typeof(App).Module);
engine.Initialize(this.Width, this.Height, hwnd, hinstance);
但是抛出:
参数4:不能从 'System.IntPtr' 转换到'HINSTANCE __ *' 参数3:can不能转换从“System.Windows.Interop.HwndSource”到 “HWND __ *”
所以,我怎么能转换到这些的?
完美同步,+1;) – Pragmateek