Пример #1
0
        void repositionOverlay_Tick(object sender, EventArgs e)
        {
            // We aren't even being displayed
            if (!IsPulledDown)
                return;

            if (LoLClientHandle != IntPtr.Zero)
            {
                Rect rect;
                GetWindowRect(LoLClientHandle, out rect);

                if (rect.Left == -32000 && LoLClientHandle != IntPtr.Zero)
                {
                    // the game is minimized
                    this.WindowState = FormWindowState.Minimized;
                }
                else if(rect.Right == 0 && rect.Left == 0)
                {
                    // the game got closed, find the next one!
                    LoLClientHandle = IntPtr.Zero;
                }
                else
                {
                    this.WindowState = FormWindowState.Normal;

                    WindowPlacement wp = new WindowPlacement();
                    GetWindowPlacement(LoLClientHandle, ref wp);

                    this.Location = new Point(rect.Left, rect.Top);

                    this.Size = new Size(rect.Width, rect.Height);
                }
            }
            else
            {
                // We aren't logged in and such yet!  Where's the window?!
                LoLClientHandle = FindWindow(null, "PVP.net client");

                if (LoLClientHandle != IntPtr.Zero)
                {
                    //this.FormBorderStyle = FormBorderStyle.None;

                    Rect rect;
                    GetWindowRect(LoLClientHandle, out rect);

                    SetWindowPos(LoLClientHandle, (IntPtr)(-2), 0, 0, 0, 0, 0x01 | 0x02);
                }
                else
                {
                    //this.FormBorderStyle = FormBorderStyle.FixedDialog;
                }
            }

            //
            EvalPendingJS();

            SetStatus(Status);
        }
Пример #2
0
 static extern bool GetWindowPlacement(IntPtr handle, ref WindowPlacement wp);