Esempio n. 1
0
        //public static Bitmap PrintWindow(IntPtr hwnd)
        public static Bitmap window_ScreenShot(this IntPtr windowHandle)
        {
            WinAPI.RECT rc = default(WinAPI.RECT);
            WinAPI.GetWindowRect(windowHandle, ref rc);

            Bitmap   bmp       = new Bitmap(rc.Width, rc.Height, PixelFormat.Format32bppArgb);
            Graphics gfxBmp    = Graphics.FromImage(bmp);
            IntPtr   hdcBitmap = gfxBmp.GetHdc();

            WinAPI.PrintWindow(windowHandle, hdcBitmap, 0);

            gfxBmp.ReleaseHdc(hdcBitmap);
            gfxBmp.Dispose();

            return(bmp);
        }
 public Win32_Handle_Hijack restore()
 {
     if (HijackedHandle != IntPtr.Zero)
     {
         "restoring {0} to parent {1}".info(HijackedHandle, HijackedParent);
         HijackedHandle.setParent(HijackedParent);
         if (HijackedHandleRECT.Width > 0 && HijackedHandleRECT.Width > 0)
         {
             HijackedHandle.window_Move(HijackedHandleRECT.Left, HijackedHandleRECT.Top, HijackedHandleRECT.Width, HijackedHandleRECT.Height);
             HijackedHandleRECT = default(WinAPI.RECT);
         }
         HijackedParent.window_Redraw();
         HijackedHandle.window_Redraw();
         HijackedHandle = IntPtr.Zero;
     }
     return(this);
 }
Esempio n. 3
0
        public static IntPtr window_Highlight(this IntPtr windowHandle)
        {
            WinAPI.RECT rECT = new WinAPI.RECT(0, 0, 0, 0);
            WinAPI.GetWindowRect(windowHandle, ref rECT);
            WinAPI.GetParent(windowHandle);
            IntPtr windowDC = WinAPI.GetWindowDC(windowHandle);

            if (windowDC != IntPtr.Zero)
            {
                Graphics graphics = Graphics.FromHdc(windowDC, windowHandle);
                var      drawPen  = new Pen(Brushes.Red, 2f);
                graphics.DrawRectangle(drawPen, 1, 1, rECT.Width - 2, rECT.Height - 2);
                graphics.Dispose();
                WinAPI.ReleaseDC(windowHandle, windowDC);
            }

            return(windowHandle);
        }
		public Win32_Handle_Hijack restore()
		{
			if (HijackedHandle != IntPtr.Zero)
			{
				"restoring {0} to parent {1}".info(HijackedHandle, HijackedParent);
				HijackedHandle.setParent(HijackedParent);
				if(HijackedHandleRECT.Width >0 && HijackedHandleRECT.Width > 0)
				{
					HijackedHandle.window_Move(HijackedHandleRECT.Left,HijackedHandleRECT.Top, HijackedHandleRECT.Width,HijackedHandleRECT.Height);
					HijackedHandleRECT = default(WinAPI.RECT);
				}
				HijackedParent.window_Redraw();
				HijackedHandle.window_Redraw();
				HijackedHandle = IntPtr.Zero;				
			}
			return this;
		}
Esempio n. 5
0
 public static WinAPI.RECT window_Rectangle(this IntPtr windowHandle)
 {
     WinAPI.RECT rect = new WinAPI.RECT(0, 0, 0, 0);
     WinAPI.GetWindowRect(windowHandle, ref rect);
     return(rect);
 }
		public static IntPtr window_Highlight(this IntPtr windowHandle)
		{
			
			WinAPI.RECT rECT = new WinAPI.RECT(0, 0, 0, 0);
			WinAPI.GetWindowRect(windowHandle, ref rECT);
			WinAPI.GetParent(windowHandle);
			IntPtr windowDC = WinAPI.GetWindowDC(windowHandle);
			if (windowDC != IntPtr.Zero)
			{
				Graphics graphics = Graphics.FromHdc(windowDC, windowHandle);
				var drawPen = new Pen(Brushes.Red, 2f);
				graphics.DrawRectangle(drawPen, 1, 1, rECT.Width - 2, rECT.Height - 2);
				graphics.Dispose();
				WinAPI.ReleaseDC(windowHandle, windowDC);
			}
			
			return windowHandle;
		}
		public static WinAPI.RECT window_Rectangle(this IntPtr windowHandle)
		{
			WinAPI.RECT rect = new WinAPI.RECT(0, 0, 0, 0);
			WinAPI.GetWindowRect(windowHandle, ref rect);
			return rect;
		}