private void WindowThreadProc() { try { this.Initialize(); eventWindowReady.Set(); if (this.windowHandle != IntPtr.Zero) { Microsoft.Win32.NativeMethods.MSG msg = new Microsoft.Win32.NativeMethods.MSG(); bool flag = true; while (flag) { if (Microsoft.Win32.UnsafeNativeMethods.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, 0xff, 4) != 0x102) { goto Label_0072; } Thread.Sleep(1); continue; Label_0053: if (msg.message == 0x12) { flag = false; continue; } Microsoft.Win32.UnsafeNativeMethods.TranslateMessage(ref msg); Microsoft.Win32.UnsafeNativeMethods.DispatchMessage(ref msg); Label_0072: if (Microsoft.Win32.UnsafeNativeMethods.PeekMessage(ref msg, Microsoft.Win32.NativeMethods.NullHandleRef, 0, 0, 1)) { goto Label_0053; } } } this.OnShutdown(OnEventsThreadShutdownEvent); } catch (Exception exception) { eventWindowReady.Set(); if (!(exception is ThreadInterruptedException)) { ThreadAbortException exception2 = exception as ThreadAbortException; } } this.Dispose(); if (eventThreadTerminated != null) { eventThreadTerminated.Set(); } }
public static extern bool PeekMessage([In, Out] ref Microsoft.Win32.NativeMethods.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
public static extern bool TranslateMessage([In, Out] ref Microsoft.Win32.NativeMethods.MSG msg);
public static extern int DispatchMessage([In] ref Microsoft.Win32.NativeMethods.MSG msg);