Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bitmap bmp = null;
- SIZE size;
- size.cx = Screen.PrimaryScreen.Bounds.Width;
- size.cy = Screen.PrimaryScreen.Bounds.Height;
- IntPtr Src = PlatformInvokeUSER32.GetDC(IntPtr.Zero);
- IntPtr Dest = PlatformInvokeGDI32.CreateCompatibleDC(Src);
- IntPtr HBitmap = (IntPtr)null;
- IntPtr hOld = IntPtr.Zero;
- HBitmap = PlatformInvokeGDI32.CreateCompatibleBitmap(Src, size.cx, size.cy);
- hOld = (IntPtr)PlatformInvokeGDI32.SelectObject(Dest, HBitmap);
- PlatformInvokeGDI32.BitBlt(Dest, 0, 0, size.cx, size.cy, Src, 0, 0, PlatformInvokeGDI32.SRCCOPY);
- PlatformInvokeGDI32.SelectObject(Dest, hOld);
- PlatformInvokeGDI32.DeleteDC(Dest);
- PlatformInvokeUSER32.ReleaseDC(IntPtr.Zero, Src);
- bmp = System.Drawing.Image.FromHbitmap(HBitmap);
- PlatformInvokeGDI32.DeleteObject(HBitmap);
- return bmp;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement