title: How to capture the screen and mouse pointer using Windows APIs?
body: <p>I'm using the below code to capture the screen in a bitmap. The screen is captured, but I'm unable to get the mouse pointer on the screen. Could you suggest some alternative approach so that the mouse is captured as well?</p>
  
  <pre><code>    private Bitmap CaptureScreen()
      {
          // Size size is how big an area to capture
          // pointOrigin is the upper left corner of the area to capture
          int width = Screen.PrimaryScreen.Bounds.X + Screen.PrimaryScreen.Bounds.Width;
          int height = Screen.PrimaryScreen.Bounds.Y + Screen.PrimaryScreen.Bounds.Height;
          Size size = new Size(width, height);
          Point pointOfOrigin = new Point(0, 0);
  
          Bitmap bitmap = new Bitmap(size.Width, size.Height);
          {
              using (Graphics graphics = Graphics.FromImage(bitmap))
              {
                  graphics.CopyFromScreen(pointOfOrigin, new Point(0, 0), size);
              }
              return bitmap;
          }
      }
  </code></pre>