コード例 #1
0
        public static void AnimateMinimizeToTray(Form form)
        {
            if (UseWindowAnimation())
            {
                int hwnd = (int)form.Handle;
                User32.RECT rectFrom = new User32.RECT();
                User32.RECT rectTo = new User32.RECT();

                User32.GetWindowRect(hwnd, ref rectFrom);
                GetTrayWndRect(ref rectTo);

                User32.DrawAnimatedRects(hwnd, User32.IDANI_CAPTION, ref rectFrom, ref rectTo);
            }
        }
コード例 #2
0
ファイル: Pandora.cs プロジェクト: npoCaputo/openpandora
        private void LocateRadio()
        {
            if (located)
            {
                return;
            }

            if (radioSize.Height == 0 || radioSize.Width == 0)
            {
                radioSize = GetRadioSize(browser);

                if (radioSize.Height == 0 || radioSize.Width == 0)
                {
                    return;
                }
            }

            hwndPandora = 0;

            int hShellDocObjectView = User32.FindWindowEx((int)browser.Handle, 0, "Shell DocObject View", null);
            int hInternetExplorerServer = User32.FindWindowEx(hShellDocObjectView, 0, "Internet Explorer_Server", null);

            int height = 0;
            int width = 0;

            do
            {
                hwndPandora = User32.FindWindowEx(hInternetExplorerServer, hwndPandora, "MacromediaFlashPlayerActiveX", null);

                if (hwndPandora != 0)
                {
                    User32.RECT rc = new User32.RECT();
                    User32.GetWindowRect(hwndPandora, ref rc);

                    height = rc.bottom - rc.top;
                    width = rc.right - rc.left;
                }
            } while (!(height == radioSize.Height && width == radioSize.Width) && hwndPandora != 0);

            Debug.WriteLine("hwndRadio: " + hwndPandora);

            // Setting located true even though we didn't find, to prevent repeated
            // call to located on each user event.
            located = true;
        }
コード例 #3
0
        private static bool FindTrayWindow(int hwnd, ref User32.RECT lParam)
        {
            // Initialize a string to the max class name length.
            string szClassName = new string(' ', 256);

            User32.GetClassName(hwnd, szClassName, szClassName.Length - 1);

            // Did we find the Main System Tray? If so, then get its size and keep going
            if (szClassName.StartsWith("TrayNotifyWnd"))
            {
                User32.GetWindowRect(hwnd, ref lParam);

                // We aren't done yet. Keep looking for children windows
                return true;
            }

            // Did we find the System Clock? If so, then adjust the size of the rectangle
            // so our rectangle will be between the outside edge of the tray and the edge
            // of the clock. In other words, our rectangle will not include the clock's
            // rectangle. This works because the clock window will be found after the
            // System Tray window. Once we have our new size can quit looking for remaining
            // children.
            if (szClassName.StartsWith("TrayClockWClass"))
            {
                User32.RECT rectClock = new User32.RECT();
                User32.GetWindowRect(hwnd, ref rectClock);

                // if clock is above system tray adjust accordingly
                if (rectClock.bottom < lParam.bottom - 5) // 10 = random fudge factor.
                {
                    lParam.top = rectClock.bottom;
                }
                else
                {
                    lParam.right = rectClock.left;
                }

                // Quit looking for children
                return false;
            }

            // We aren't done yet. Keep looking for children windows
            return true;
        }