Hi, I found another solution for .NET 2008 (maybe it works with 2005 too).
Edit: Oh, it seems that mouse input does not work... only keyboard...
Add the following class to your project (C#):
B3DMessageFilter.cs
This message filter filters messages for the specified render target control. Whenever a message is received it looks for the child control and sets the input focus to this control.
How to use the filter:
Edit: Oh, it seems that mouse input does not work... only keyboard...
Add the following class to your project (C#):
B3DMessageFilter.cs
using System; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Security.Permissions; [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public class B3DMessageFilter : IMessageFilter { [DllImport("user32.dll")] extern private static int FindWindowEx(int parent_hwnd, int child_hwnd, int classname, int name); [DllImport("user32.dll")] extern private static int SetFocus(int hwnd); private IntPtr handle; private int child_hwnd; public B3DMessageFilter(IntPtr handle) { this.handle = handle; } #region IMessageFilter Members public bool PreFilterMessage(ref Message m) { if (m.HWnd == handle) { if (child_hwnd == 0) child_hwnd = FindWindowEx(handle.ToInt32(), 0, 0, 0); if (child_hwnd != 0) SetFocus(child_hwnd); } return false; } #endregion }
This message filter filters messages for the specified render target control. Whenever a message is received it looks for the child control and sets the input focus to this control.
How to use the filter:
B3DMessageFilter filter = new B3DMessageFilter(render_target_control.Handle); Application.AddMessageFilter(filter); Blitz3DSDK.SetBlitz3DHWND(render_target_control.Handle.ToInt32()); Blitz3DSDK.BeginBlitz3D(); ... if (Blitz3DSDK.KeyHit(Blitz3DSDK.KEY_ESCAPE) == 1) { ... } ... Blitz3DSDK.EndBlitz3D(); Application.RemoveMessageFilter(filter);