public byte[] GetDesktop_ResizedBytes(int w, int h)
{
Size DesktopBitmapSize = GetDesktopBitmapSize();
Graphics Graphic = Graphics.FromHwnd(GetDesktopWindow());
Bitmap MemImage = new Bitmap(DesktopBitmapSize.Width, DesktopBitmapSize.Height, Graphic);
Graphics MemGraphic = Graphics.FromImage(MemImage);
IntPtr dc1 = Graphic.GetHdc();
IntPtr dc2 = MemGraphic.GetHdc();
BitBlt(dc2, 0, 0, DesktopBitmapSize.Width, DesktopBitmapSize.Height, dc1, 0, 0, SRCCOPY);
Graphic.ReleaseHdc(dc1);
MemGraphic.ReleaseHdc(dc2);
Graphic.Dispose();
MemGraphic.Dispose();
Graphics g = System.Drawing.Graphics.FromImage(MemImage);
System.Windows.Forms.Cursor cur = System.Windows.Forms.Cursors.Arrow;
cur.Draw(g, new Rectangle(System.Windows.Forms.Cursor.Position.X - 10, System.Windows.Forms.Cursor.Position.Y - 10, cur.Size.Width, cur.Size.Height));
Image img = Get_Resized_Image(w, h, MemImage);
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
return(ms.GetBuffer());
}