internal static extern LRESULT DispatchMessage(ref MSG msg);
internal static extern BOOL TranslateMessage(ref MSG lpMsg);
internal static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, PeekMessageFlags flags);
//[return: MarshalAs(UnmanagedType.Bool)] internal static extern INT GetMessage(ref MSG msg, IntPtr windowHandle, int messageFilterMin, int messageFilterMax);
void ProcessEvents() { Native = ConstructMessageWindow(); CreateDrivers(); // Subclass the window to retrieve the events we are interested in. OldWndProc = Functions.SetWindowLong(Parent.Handle, WndProc); Debug.Print("Input window attached to {0}", Parent); InputReady.Set(); MSG msg = new MSG(); while (Native.Exists) { int ret = Functions.GetMessage(ref msg, Parent.Handle, 0, 0); if (ret == -1) { throw new PlatformException(String.Format( "An error happened while processing the message queue. Windows error: {0}", Marshal.GetLastWin32Error())); } Functions.TranslateMessage(ref msg); Functions.DispatchMessage(ref msg); } }
private void ProcessEvents() { this.Native = this.ConstructMessageWindow(); this.CreateDrivers(); this.OldWndProc = Functions.SetWindowLong(this.Parent.WindowHandle, this.WndProc); this.InputReady.Set(); MSG msg = new MSG(); while (this.Native.Exists) { if (Functions.GetMessage(ref msg, this.Parent.WindowHandle, 0, 0) == -1) throw new PlatformException(string.Format("An error happened while processing the message queue. Windows error: {0}", (object) Marshal.GetLastWin32Error())); Functions.TranslateMessage(ref msg); Functions.DispatchMessage(ref msg); } }
internal static bool TranslateMessage(ref MSG lpMsg);
internal static IntPtr DispatchMessage(ref MSG msg);
internal static extern bool TranslateMessage(ref MSG lpMsg);
internal static extern IntPtr DispatchMessage(ref MSG msg);
internal static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);