I have the following C# code, which I am using to capture a screenshot inside a remote desktop (RDP) session. It works fine when the session is active, but fails with an invalid handle exception if I minimize the session.
Is there any way to make this work, or is the screen essentially "gone" when the session is minimized?
string filename = @"C:\Snap.png";
Size bitmapSize = new Size( Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height );
using (Bitmap bitmap = new Bitmap(bitmapSize.Width, bitmapSize.Height, PixelFormat.Format24bppRgb))
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.CopyFromScreen( // Exception thrown here
new Point(0, 0),
new Point(0, 0),
bitmapSize);
bitmap.Save(filename, ImageFormat.Png);
}
“Ctrl” + “Alt” + “-”: This command takes a screenshot of the active window on the host computer's screen, saving it to the guest computer.
Press Windows+Shift+S to open the Snipping Tool. 2. Select what type of screenshot you want from the Mode menu. Click the 'Mode' button on the Snipping Tool to open a drop-down menu and select from the various different types of screenshots, from full-screen to just a selected portion.
Use Windows key + PrtSc key to take a full screen screenshot and save it to your computer. Similar to the PrtSc key windows key, hitting the Windows key + Print Scren keys will grab a screenshot of your entire desktop but only on an active window.
You have to temporarily restore the window, capture, and minimize it again. This link shows how to do it silently
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With