About Screen Capture

It is sometimes necessary to make a hidden window block or a window taken in real-time status

Commonly used bitblt ()

If the source device region pixel may be copied to the target area, and block or hidden in the window on the powerless

This can be used when PrintWindow, whether the window is hidden, or blocked can cut out the desired area

 

    IntPtr hscrdc = GetWindowDC(hWnd);
              Control control = Control.FromHandle(hWnd);
              IntPtr hbitmap = CreateCompatibleBitmap(hscrdc, control.Width, control.Height);
              IntPtr hmemdc = CreateCompatibleDC(hscrdc);
              SelectObject(hmemdc, hbitmap);
              bool re= PrintWindow(hWnd, hmemdc, 0);
              Bitmap bmp = null;
              if(re)
              {
                 bmp = Bitmap.FromHbitmap(hbitmap);                  
              }

Guess you like

Origin www.cnblogs.com/ice-arrow/p/11981046.html