public unsafe EngineDisplayForm() { InitializeComponent(); try { // This is how we get the instance handle for our C# app. System.IntPtr hInstance = System.Runtime.InteropServices.Marshal.GetHINSTANCE(this.GetType().Module); // This is how we get the window handle for the panel we'll be rendering into. IntPtr hwnd = this.DisplayPanel.Handle; // Call into our Dll main function, which will set up an instance of the EditorApp project. // Remember that we can't pass the pointer itself, so we'll pass the pointer value. // The int will be converted into a pointer value later. NativeMethods.EditorMain(hInstance, IntPtr.Zero, hwnd, 1, this.DisplayPanel.Width, this.DisplayPanel.Height); m_messageFilter = new MessageHandler(this.Handle, this.DisplayPanel.Handle, this); m_actorPropertiesForm = new ActorPropertiesForm(this); m_actorPropertiesForm.Show(); } catch (Exception) { // If something goes wrong with the initialization, free the library // TODO QT: Why is this commented out???? Maybe Quoc knows... // NativeMethods.FreeLibrary(m_pDll); } }