コード例 #1
0
        public MoveWindowCommand()
        {
            initialState        = new tagWINDOWINFO();
            initialState.cbSize = (uint)Marshal.SizeOf(initialState);
            GetWindowInfo(hWnd, ref initialState);

            int safeDistance = DesktopSnapshotCommand.DefaultRect.Width + 50;

            if (initialState.rcWindow.left < safeDistance)
            {
                Execution.ExecutionEventLog.RecordStatus("Moving the test console window to upper-middle for Visual Verification stability - Sorry for the inconvenience.");
                MoveWindow(hWnd,
                           safeDistance,
                           200,
                           initialState.rcWindow.right - initialState.rcWindow.left,
                           initialState.rcWindow.bottom - initialState.rcWindow.top, true);
                UpdateWindow(hWnd);
            }
        }
コード例 #2
0
        private static bool Report(int hwnd, int lParam)
        {
            IntPtr        ptr  = new IntPtr(hwnd);
            tagWINDOWINFO info = new tagWINDOWINFO();

            GetWindowInfo(ptr, ref info);

            if (IsWindowVisible(ptr) && !IsIconic(ptr) && info.cxWindowBorders > 0 && info.cyWindowBorders > 0)
            {
                string title = GetText(new IntPtr(hwnd));

                if (title != "")
                {
                    WindowSpec spec = new WindowSpec();
                    spec.Caption = title;
                    spec.Hwnd    = ptr;
                    spec.Info    = info;

                    Bitmap            bm = GetWindowPreview(spec);
                    BitmapImage       bi = ConvertBitmapToBitmapImage(bm);
                    TransformedBitmap tb = new TransformedBitmap();
                    tb.BeginInit();
                    tb.Source = bi;

                    double ratio     = bi.Height / bi.Width;
                    double newHeight = 150 * ratio;
                    double scaleX    = 150 / bi.Width;
                    double scaleY    = newHeight / bi.Height;

                    ScaleTransform transform = new ScaleTransform(scaleX, scaleY);
                    tb.Transform = transform;
                    tb.EndInit();
                    spec.Preview = tb;
                    WindowNames.Add(spec);
                }
            }

            return(true);
        }
コード例 #3
0
 public static extern bool GetWindowInfo(IntPtr hwnd, ref tagWINDOWINFO pwi);
コード例 #4
0
        private static bool Report(int hwnd, int lParam)
        {
            IntPtr ptr = new IntPtr(hwnd);
            tagWINDOWINFO info = new tagWINDOWINFO();
            GetWindowInfo(ptr, ref info);

            if (IsWindowVisible(ptr) && !IsIconic(ptr) && info.cxWindowBorders > 0 && info.cyWindowBorders > 0)
            {
                string title = GetText(new IntPtr(hwnd));

                if (title != "")
                {
                    WindowSpec spec = new WindowSpec();
                    spec.Caption = title;
                    spec.Hwnd = ptr;
                    spec.Info = info;

                    Bitmap bm = GetWindowPreview(spec);
                    BitmapImage bi = ConvertBitmapToBitmapImage(bm);
                    TransformedBitmap tb = new TransformedBitmap();
                    tb.BeginInit();
                    tb.Source = bi;

                    double ratio = bi.Height / bi.Width;
                    double newHeight = 150 * ratio;
                    double scaleX = 150 / bi.Width;
                    double scaleY =  newHeight / bi.Height;

                    ScaleTransform transform = new ScaleTransform(scaleX, scaleY);
                    tb.Transform = transform;
                    tb.EndInit();
                    spec.Preview = tb;
                    WindowNames.Add(spec);
                }
            }

            return true;
        }
コード例 #5
0
 public static extern bool GetWindowInfo(IntPtr hwnd, ref tagWINDOWINFO pwi);
コード例 #6
0
ファイル: PInvoke.cs プロジェクト: realNickZhang/Jm.Core
 public static extern bool GetWindowInfo(int hWnd, out tagWINDOWINFO info);
コード例 #7
0
ファイル: PInvoke.cs プロジェクト: Foohy/WindowManager
 public static extern bool GetWindowInfo(int hWnd, out tagWINDOWINFO info);