예제 #1
0
        internal bool LocalModalMessageLoop(LightWindow window)
        {
            try
            {
                MSG  msg   = new MSG();
                bool flag  = false;
                bool flag2 = true;
                while (flag2)
                {
                    if (!NativeMethods.PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0))
                    {
                        goto Label_Wait;
                    }
                    if ((msg.hwnd != IntPtr.Zero) && NativeMethods.IsWindowUnicode(new HandleRef(null, msg.hwnd)))
                    {
                        flag = true;
                        if (NativeMethods.GetMessageW(ref msg, IntPtr.Zero, 0, 0))
                        {
                            goto Label_Translate;
                        }
                        continue;
                    }
                    flag = false;
                    if (!NativeMethods.GetMessageA(ref msg, IntPtr.Zero, 0, 0))
                    {
                        continue;
                    }
Label_Translate:
                    NativeMethods.TranslateMessage(ref msg);
                    if (flag)
                    {
                        NativeMethods.DispatchMessageW(ref msg);
                    }
                    else
                    {
                        NativeMethods.DispatchMessageA(ref msg);
                    }
                    if (window != null)
                    {
                        flag2 = NativeMethods.IsWindowVisible(window.handle);
                    }

                    continue;
Label_Wait:
                    if (window == null)
                    {
                        break;
                    }
                    if (!NativeMethods.PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0))
                    {
                        NativeMethods.WaitMessage();
                    }
                }
                return(flag2);
            }
            catch
            {
                return(false);
            }
        }
예제 #2
0
        public void InsertAfter(LightWindow window)
        {
            if (window == null)
            {
                return;
            }

            if (this.Handle == IntPtr.Zero)
            {
                return;
            }

            if (window.Handle == IntPtr.Zero)
            {
                return;
            }

            NativeMethods.WindowInsertAfter(handle, window.Handle);
        }