如何传递 C# WPF 表单的 HWND 和 HINSTANCE?
试图:
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: 无法从 'System.Windows.Interop.HwndSource' 转换为 'HWND__*'
那么我怎样才能将这些转换成那些呢?